Debugging the backend of a registration form
Posted: Thu Feb 24, 2011 7:08 pm
im trying to develop the backend of a registration form in php with some email validation stuff thrown in and i've run into some problems...the form is supposed to gather all of the information and email it to the administrator of the site but i keep getting a parse syntax error unexpected T_STRING at line 53 and im not sure what the problem is. i dont mess with php too much, and im not sure how to diagnose this...perhaps the problem is simply ignorance, lol.
anyway, i'd appreciate anyone's input they can give me on this. here is the html form:
...and heres the backend im attempting to write in PHP:
anyway, i'd appreciate anyone's input they can give me on this. here is the html form:
Code: Select all
<form name="register" method="post" action="register.php"><pre>
First Name: <input type="text" name="firstn" value="">  Family Name: <input type="text" name="lastn" value=""><BR>
Organization: <input type="text" name="org" value=""><BR>
Office Address: <input type="text" name="add" value=""><BR>
Country: <input type="text" name="country" value=""><BR>
Telephone: <input type="text" name="tele" value="">  Fax: <input type="text" name="fax" value="">  Email: <input type="text" name="email" value=""><BR>
Will you be attending the social event? Yes<input type="radio" name="attending" value="yes">  No<input type="radio" name="attending" value="no"><BR>
Will you be accompanied by a guest? Yes<input type="radio" name="guest" value="yes">  No<input type="radio" name="guest" value="no"><BR>
Name of guest: <input type="text" name="guestn" value=""><BR>
Special Dietary restrictions: <input type="text" name="diets" value=""><BR>
Special accessibility requirements: <input type="text" name="access" value=""><BR>
<BR><BR><hr><br>
<center><h2>VISA Request Information</h2>
<BR><BR>
If a VISA letter is needed, please provide the following information as soon as possible,
and no later than July 1st, 2011 in order to allow adequate time for processing.
<BR>See also:<BR>
<a href="http://travel.state.gov/visa/visa_1750.html">http://travel.state.gov/visa/visa_1750.html</a><BR>
<a href="http://travel.state.gov/visa/temp/without/without_1261.html">http://travel.state.gov/visa/temp/without/without_1261.html</a><BR>
</center>
<BR><BR>
Family Name: <input type="text" name="vfname" value="">  First Name: <input type="text" name="vname" value=""><BR>
Date of Birth: <input type="text" name="vdob" value=""><BR>
Nationality: <input type="text" name="vnat" value=""><BR>
Passport Number: <input type="text" name="vpass_num" value=""><BR>
Email: <input type="text" name="vemail" value=""><BR>
Occupation: <input type="text" name="vocc" value=""><BR>
Organization: <input type="text" name="vorg" value=""><BR>
<center><INPUT class="buttonRocks" TYPE="button" NAME="submit" Value="Register" action="register.php"></center>Code: Select all
<?php
/*function to validate input*/
function spam($field)
{
$field=filter_var($field, FILTER_SANITIZE_EMAIL);
if(filter_var($field, FILTER_VALIDATE_EMAIL))
{
return TRUE;
}
else
{
return FALSE;
}
}
if (isset($_REQUEST['email']))
{
/* email validation---------
if
*/
$mailcheck = spam($_REQUEST['email']);
if ($mailcheck==FALSE)
{
echo "Invalid input";
}
else
{
/* send email */
$email = $_REQUEST['email'];
$firstn = $_REQUEST['firstn'];
$lastn = $_REQUEST['lastn'];
$org = $_REQUEST['org'];
$addy = $_REQUEST['add'];
$co = $_REQUEST['country'];
$tel = $_REQUEST['tele'];
$fax = $_REQUEST['fax'];
$att = $_REQUEST['attending'];
$gue = $_REQUEST['guest'];
$guen = $_REQUEST['guestn'];
$diet = $_REQUEST['diets'];
$access = $_REQUEST['access'];
$vfname = $_REQUEST['vfname'];
$vname = $_REQUEST['vname'];
$vdob = $_REQUEST['vdob'];
$vnat = $_REQUEST['vnat'];
$vpass = $_REQUEST['vpass_num'];
$vemail = $_REQUEST['vemail'];
$vocc = $_REQUEST['vocc'];
$vorg = $_REQUEST['vorg'];
$message ="This email is to inform you of a recent online registration for JTC \n This is their contact information:","\n First name: ",$firstn,"\n Family name: ",$lastn,"\n Organization: ",$org,"\n Mailing Address: ",$addy,"\n Country",$co,"\n Telephone: ",$tel,"\n Fax: ",$fax,"\n Email: ",$email,"\n Attending? ",$attending,"\n Accompanied by Guest?",$gue,"\n Guest's name:",$guen,"\n Dietary restrictions: ",$diet,"\n Accessibility Requirements: ",$access,"\n VISA Information: (if applicable) \n \n Family name: ",$vfname+"\n First name: ",$vname,"\n Date of Birth: ",$vdob,"\n Nationality: ",$vnat,"\n Passport Number: ",$vpass,"\n Email: ",$vemail,"\n Occupation: ",$vocc,"\n Organization: ",$vorg;
mail("hexahubris@hotmail.com", "Subject: New JTC Registrant",$message, "From: $email" );
echo "Thank you for registering with us!";
}
}
else
{ //if "email" is not filled out, display the form
echo file_get_contents("registration.html");
}
?>