Menu

Form doesn't send data

2010-05-04
2013-06-03
  • Lloyd Chittenden

    I'm trying to use PHPFormGenerator for the first time.  I do not know PHP.  I'm using version 2.09, which is what my host provides. 

    The problem is that the form sends an email, but the email only contains the field labels, no data.  It looks like this:

    First name:
    Last name:
    First name to appear on badge:
    Organization:
    Mailing Address:
    Phone Number:
    Email Address:

    Here is my form:
    <HTML><HEAD><TITLE>My Form - created with phpFormGenerator</TITLE></HEAD>
    <BODY>
    <font face='arial' size=2><b>All fields marked with a * are required:<br>
    <form enctype='multipart/form-data' action='process.php' method='post'>
    <table width='50%' border=0>
    <tr><td> First name<font color='#ff0000'>*</font></td>
    <td>
    <input type=text name='First_name' size=40></td></tr>
    <tr><td> Last name<font color='#ff0000'>*</font></td>
    <td>
    <input type=text name='Last_name' size=40></td></tr>
    <tr><td> First name on badge</td>
    <td>
    <input type=text name='First_name_on_badge' size=40></td></tr>
    <tr><td> Organization</td>
    <td>
    <input type=text name='Organization' size=50></td></tr>
    <tr><td> Mailing Address</td>
    <td>
    <textarea name='Mailing_Address' rows=4 cols=50></textarea></td></tr>
    <tr><td> Phone Number</td>
    <td>
    <input type=text name='Phone_Number' size=15></td></tr>
    <tr><td> Email Address<font color='#ff0000'>*</font></td>
    <td>
    <input type=email name='Email_Address' size=40></td></tr>
    <tr><td> Lunch Preference</td>
    <td>
    <input type=radio name='Lunch_Preference' value='Chicken'>Chicken<br><input type=radio name='Lunch_Preference' value='Pork'>Pork<br><input type=radio name='Lunch_Preference' value='Vegetarian'>Vegetarian<br></td></tr>
    <tr><td> Dietary restrictions or concerns</td>
    <td>
    <input type=text name='Dietary_restrictions_or_concerns' size=40></td></tr>
    <tr><td> Basic videorecordings</td>
    <td>
    <select name='Basic_videorecordings'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    <tr><td> Advanced videorecordings</td>
    <td>
    <select name='Advanced_videorecordings'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    <tr><td> New video formats</td>
    <td>
    <select name='New_video_formats'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    <tr><td> Streaming video</td>
    <td>
    <select name='Streaming_video'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    <tr><td> Realia</td>
    <td>
    <select name='Realia'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    <tr><td> Archival materials</td>
    <td>
    <select name='Archival_materials'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    <tr><td> Basic sound recordings</td>
    <td>
    <select name='Basic_sound_recordings'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    <tr><td> Advanced sound recordings</td>
    <td>
    <select name='Advanced_sound_recordings'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    <tr><td> Form and genre headings</td>
    <td>
    <select name='Form_and_genre_headings'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    <tr><td> Graphic materials</td>
    <td>
    <select name='Graphic_materials'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    <tr><td> Electronic resources</td>
    <td>
    <select name='Electronic_resources'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    <tr><td> Ebooks</td>
    <td>
    <select name='Ebooks'><option value='-'>-<option value='1'>1<option value='2'>2<option value='3'>3<option value='4'>4<option value='5'>5<option value='6'>6<option value='7'>7<option value='8'>8</select></td></tr>
    </table>
    <input type='submit' value='Submit Form'> <input type=reset value='Clear Form'></form>
    <br><br><br><a href='http://phpformgen.sourceforge.net'><img src='button.jpg' border=0></a>
    </BODY></HTML>

    This is my process.php:

    <?php
    include("global.inc.php");
    $errors=0;
    $error="The following errors occured while processing your form input.<ul>";
    pt_register('POST','First_name');
    pt_register('POST','Last_name');
    pt_register('POST','First_name_on_badge');
    pt_register('POST','Organization');
    pt_register('POST','Mailing_Address');
    $Mailing_Address=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $Mailing_Address);
    pt_register('POST','Phone_Number');
    pt_register('POST','Email_Address');
    pt_register('POST','Lunch_Preference');
    pt_register('POST','Dietary_restrictions_or_concerns');
    pt_register('POST','Basic_videorecordings');
    pt_register('POST','Advanced_videorecordings');
    pt_register('POST','New_video_formats');
    pt_register('POST','Streaming_video');
    pt_register('POST','Realia');
    pt_register('POST','Archival_materials');
    pt_register('POST','Basic_sound_recordings');
    pt_register('POST','Advanced_sound_recordings');
    pt_register('POST','Form_and_genre_headings');
    pt_register('POST','Graphic_materials');
    pt_register('POST','Electronic_resources');
    pt_register('POST','Ebooks');
    if($First_name=="" || $Last_name=="" || $Email_Address=="" ){
    $errors=1;
    $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
    }
    if($errors==1) echo $error;
    else{
    $where_form_is="http".($HTTP_SERVER_VARS=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
    $message="First name: ".$First_name."
    Last name: ".$Last_name."
    First name to appear on badge: ".$First_name_on_badge."
    Organization: ".$Organization."
    Mailing Address: ".$Mailing_Address."
    Phone Number: ".$Phone_Number."
    Email Address: ".$Email_Address."
    Lunch Preference: ".$Lunch_Preference."
    Dietary restrictions or concerns: ".$Dietary_restrictions_or_concerns."
    Basic videorecordings: ".$Basic_videorecordings."
    Advanced videorecordings: ".$Advanced_videorecordings."
    New video formats: ".$New_video_formats."
    Streaming video: ".$Streaming_video."
    Realia: ".$Realia."
    Archival materials: ".$Archival_materials."
    Basic sound recordings: ".$Basic_sound_recordings."
    Advanced sound recordings: ".$Advanced_sound_recordings."
    Form and genre headings: ".$Form_and_genre_headings."
    Graphic materials: ".$Graphic_materials."
    Electronic resources: ".$Electronic_resources."
    Ebooks: ".$Ebooks."
    ";
    $message = stripslashes($message);
    mail("chittenden_l@fortlewis.edu","Form Submitted at your website",$message,"From: phpFormGenerator");

    header("Refresh: 0;url=http://www.olacinc.org/drupal/conference/2010/Payment.html");
    ?><?php
    }
    ?>

     
  • Martzee

    Martzee - 2010-12-07

    Your problem is in the names of your variables. They shouldn't contain any special characters such as commas, underlines etc, so $Form_and_genre_headings is not valid name. rename it all to something shorter or something like FormAndGenreHeadings and the code should start working. ideally I would choose "formgenre" only as a unique name. using capitals may be dangerous if you host on Linux server which cares about how the name is written.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.