0

I'm fairly decent in php programming and I know this type of error means that I'm missing something, but I can't seem to figure out what I'm missing. I have all the brackets and semicolons where they should be. I don't know why this error is showing. Here is the code below:

Parse error: syntax error, unexpected T_VARIABLE in C:\Program Files (x86)\EasyPHP-5.3.9\www\Website Stuff\Form.php on line 44

<?php
error_reporting (E_ALL ^ E_NOTICE); 

$to = "gene.howell9@gmail.com";
$subject = "Submitions from College/University Admission Services Form";

$Sname = $_POST["Sname"];
$Fname = $_POST["Fname"];
$Mname = $_POST["Mname"];
$Lname = $_POST["Lname"];
$email = $_POST["email"];
$history = $_POST["history"];
$age = $_POST["age"];
$sex = $_POST["sex"];
$country = $_POST["country"];
$SchoolsAttended = $_POST["SchoolsAttended"];
$CriminalRecord = $_POST["CriminalRecord"];
$record = $_POST["record"];
$status = $_POST["status"];

$body = <<<EMAIL

Form submitted from $Fname $Lname.

Surname field: $Sname
First name field: $Fname
Middle name field: $Mname
Last name field: $Lname
History field: $history
Age: $age
Sex: $sex
Country: $country
Schools Attended: $SchoolsAttended
Criminal Record: $CriminalRecord
If yes was selected, list of details: $record
Marital Status: $status

From, $Fname

EMAIL;

$header = "From: $email";
if($_POST){
   if($Sname == '' || $Fname == '' $Mname == '' || $Lname == '' $email == '' || $history == '' $age == '' || $sex == '' $country == '' || $SchoolsAttended == '' $CriminalRecord == '' || $status == ''){
    $feedback = "Fill out all the fields please before submitting";
}else{
mail($to, $subject, $body, $header);
$feedback ="Thanks for your submition! Your form has been sent!";
}
    }
    ?>
    <p id="feedback"><?php echo $feedback; ?></p>
<form style="padding: 10px;" method="post" action="?">
    Surname: <input type="text" maxlength="12" name="Sname"><br /><br />
    First Name: <input type="text" maxlength="12" name="Fname"><br /><br />
    Middle Name: <input type="text" maxlength="12" name="Mname"><br /><br />
    Last Name: <input type="text" maxlength="36" name="Lname"><br /><br />
    Email: <input type="text" maxlength="36" name="email"><br /><br />
    History: <input type="text" maxlength="50" name="history"><br /><br />
    Age: <input type="text" size="1" maxlength="2" name="age"><br /><br />
    Sex: <input type="radio" value="Male" name="sex">Male<input type="radio" value="Female" name="sex">Female<br /><br />
    Country of Origin: <select name="country">
        <option value="Select">-Select a Country-</option>
    <option value="United States">United States</option>
    <option value="Africa">Africa</option>
    <option value="Canada">Canada</option>
           </select><br /><br />
    Schools Attended: <input type="text" name="SchoolsAttended"><br /><br />
    Do you have a criminal record? <input type="radio" value="yes" name="CriminalRecord">Yes <input type="radio" value="no" name="CriminalRecord">No<br /><br />
    If yes was selected, please list them in the field provided: <input type="text" name="record"><br /><br />
    Marital Status: <select name="status">
    <option value="select">-Select your status-</option>
    <option value="single">Single</option>
    <option value="married">Married</option>
    <option value="divorced">Divorced</option>
    <option value="widowed">Widowed</option>
        </select><br /><br />
   <input class="button" type="submit" value="submit" name="submit"> <input class="button" type="reset" value="Reset" name="reset" />
   </form>

Thanks for any help! It's probably a minor issue! -TechGuy24

hakre
  • 193,403
  • 52
  • 435
  • 836
WebDeVGuy24
  • 39
  • 1
  • 9
  • 1
    When you've understood what a syntax error is, you need to learn about XSS and HTML injection. – hakre Aug 13 '12 at 16:14
  • In addition to ^, please read this very carefully. http://stackoverflow.com/questions/60174/best-way-to-prevent-sql-injection-in-php – Sgarz Aug 13 '12 at 16:17
  • Protip: The error was probably on line 44. – Andrew Aug 13 '12 at 16:24

1 Answers1

8

You are missing a bunch of ||.

For example:

$history == '' $age == ''

should be:

$history == '' || $age == ''
snuffn
  • 2,102
  • 13
  • 15
  • That definitely fixed it, I don't know how I missed that... I guess I've been looking at the code too long that I overlooked the simple stuff. Thanks for the patience! – WebDeVGuy24 Aug 13 '12 at 16:22