I built a page with a form on it that collects information and upon submission the data should be inserted into a database. But when you hit submit I'm getting the following error:
Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\osumusic\studentappformmail.php on line 171
Line 171 on studentappformmail.php is:
$E-Mail = strip_tags($_POST['E-Mail']);
But the thing is that it went through multiple lines above it that were written the same sway without spitting out an error so what's the difference here?
Below are the codes for both pages.....
Here's the code for the page with the form on it:
<div id="content">
<div id="breadcrumb"></div>
<h1>Oklahoma State University Prospective Student Application</h1>
<div id="spacer"></div>
<form name = form1 method=post action=studentappformmail.php onsubmit='return validate(this)'><input type="hidden" name="todo" value="post" name="recipient" value="anaitis4@yahoo.com">
<p><b><u>Personal Information</u>:</b></p>
<p>First Name: <font color="#FF0000">*</font><input type="text" name="FN" size="20">
Middle Initial: <input type="text" name="MI" size="4"> Last Name: <font color="#FF0000">*</font><input type="text" name="LN" size="20"></p>
<p>Parent or Guardian: <input type="text" name="Parent" size="40"></p>
<p><b><u>Permanent Home Address</u></b> <font color="#FF0000">*</font></p>
<p>Street:<span class="style5">*</span>
<input type="text" name="HomeAddress" size="50"></p>
<p>City:<font color="#FF0000">*</font> <input type="text" name="City" size="49"></p>
<p>State:<font color="#FF0000">*</font> <input type="text" name="St" size="15"></p>
<p>Zip:<font color="#FF0000">*</font> <input type="text" name="ZIP" size="10"></p>
<p>Home Phone <font size="1">ex:(123) 123.1234</font><font color="#FF0000">*</font>: <input name="HomePhone" type="text" size="20">
<p>E-mail Address:<font color="#FF0000">*</font> <input type="text" name="E-Mail" size="40"></p>
<p><b><u>Academic Information</u></b></p>
<p>Anticipated Major<font color="#FF0000">*</font> <input type="text" name="Major" size="20">
<p>ACT/SAT Score: <input type="text" name="ACT" size="3"></p>
<p>Have you applied for admission to USM? <input type="radio" name="AppliedAdm" value="yes"> yes<input type="radio" name="AppliedAdm" value="no"> no </p>
<p>Instrument: <font color="#FF0000">*</font> <input type="text" name="Instrument" size="20"></p>
<p>Interest:
<input type="checkbox" name="Interest" value="Band">Band
<input type="checkbox" name="Interest" value="Flag Corps">Flag Corps
<input type="checkbox" name="Interest" value="Dixie Darlings">Dixie Darlings</p>
<p>High School Name <font size="1">(no abbreviations)</font> <input type="text" name="HS" size="50"></p>
<p>High School Band Director <input type="text" name="HSDir" size="50"></p>
<p>Anticipated High School Graduation Date: <input type="text" name="GradDate" size="20"></p>
<p><b><u>Biographical Information and Comments</u>:</b></p>
<p align="center"><textarea name="Bio" cols="80" rows="10"></textarea></p>
<blockquote>
<div align="left">
</div>
</blockquote>
<p><font color="#FF0000">*</font></font></b><i>Required for application to be accepted.</font></i></p>
<p align="center"><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></p>
<p align="center"><i>or print and mail to:</i></p>
<p align="center"><b>Oklahoma State University<br>
c/o Prospective Student Application Processing<br>
132 Seretean Center<br>
Stillwater, OK 74078-4077</b></p>
</form>
And here's the code on the page that's supposed to process that form and insert data into the database:
//Place at top of page:
<?php
require 'db.php';
?>
//Place in <body>:
<?php
$FN = strip_tags($_POST['FN']);
$MI = strip_tags($_POST['MI']);
$LN = strip_tags($_POST['LN']);
$Parent = strip_tags($_POST['Parent']);
$HomeAddress = strip_tags($_POST['HomeAddress']);
$City = strip_tags($_POST['City']);
$St = strip_tags($_POST['St']);
$ZIP = strip_tags($_POST['ZIP']);
$HomePhone = strip_tags($_POST['HomePhone']);
$E-Mail = strip_tags($_POST['E-Mail']);
$Major = strip_tags($_POST['Major']);
$ACT = strip_tags($_POST['ACT']);
$AppliedAdm = strip_tags($_POST['AppliedAdm']);
$Instrument = strip_tags($_POST['Instrument']);
$Interest = strip_tags($_POST['Interest']);
$HS = strip_tags($_POST['HS']);
$HSDir = strip_tags($_POST['HSDir']);
$GradDate = strip_tags($_POST['GradDate']);
$Bio = strip_tags($_POST['Bio']);
$query = "INSERT INTO potential_students (FN, MI, LN, Parent, HomeAddress, City, St, ZIP, HomePhone, E-Mail, Major, ACT, AppliedAdm, Instrument, Interest, HS, HSDir, GradDate, Bio) VALUES ('$_POST[FN]', '$_POST[MI]', '$_POST[LN]', '$_POST[Parent]', '$_POST[HomeAddress]','$_POST[City]','$_POST[St]','$_POST[ZIP}','$_POST[HomePhone]',
'$_POST[E-Mail]','$_POST[Major]','$_POST[ACT]','$_POST[AppliedAdm]','$_POST[Instrument]',
'$_POST[Interest]','$_POST[HS]','$_POST[HSDir]','$_POST[GradDate]','$_POST[Bio]')";
mysql_query($query) or die ('There was an error submitting your information');
echo "Your Information has been Submitted.";
?>
Any clue what I'm screwing up?
Thanks in advance.