Jump to content

Help! Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'


mlummus

Recommended Posts

I'm learning PHP and am having an issue I can't seem to figure out this issue. I'm getting the following error on the line:

{echo "<option value='freshman' selected = 'selected'>Freshman</option>}";}

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /net/oitg/export/home1/home3/mdl0002/public_html/assignment1/lookupstudent.php  on line 58

 

Any help is much appreciated. Thanks!

 

$SQLstring = "SELECT * FROM student WHERE id = '$id'";
$QueryResult = @mysql_query($SQLstring);

$NumRows = mysqli_num_rows($QueryResult);   
if ($NumRows == 0)
echo "<p>No Records Found.";
else {
$Row = mysql_fetch_arraw($QueryResult);
$id = $Row['id'];
$name_last = $Row['name_last'];
$name_first = $Row['name_first'];
$email = $Row['email'];
$class = $Row['class'];
$major = $Row['major'];
$living = $Row['living'];  


echo "<form action='updatestudent.php' method='get'>";

echo "ID <input type='text' name='id' value=$id/> <br />"; 
echo "Last Name <input type='text' name='name_last' value=$name_last /> <br /> ";
echo "First Name <input type='text' name='name_first' value=$name_first/> <br /> ";
echo "Email Address <input type='text' name='email' value=$email/> <br /> ";


echo "Classification <select name='class'>

if ($class == 'freshman')
{echo "<option value='freshman' selected = 'selected'>Freshman</option>}";}
else {echo "<option value='freshman'> Freshman </option>";}

if ($class == 'sophomore')
{echo "<option value='sophomore' selected = 'selected'> Sophomore </option>";}
else {echo "<option value='sophomore'> Sophomore </option>";}

if ($class == "junior")
{echo "<option value='junior' selected = 'selected' Junior </option>";}
else {echo "<option value='junior'> Junior </option>";}

if ($class == "senior")
{echo "<option value='senior' selected = 'selected' Senior </option>";}
else {echo "<option value='senior'> Senior </option>";}

if ($class == "graduate")
{echo "<option value='graduate' selected = 'selected' Graduate </option>";}
else {echo "<option value='graduate'> Graduate </option>";}
</select> <br />";

<input type="submit">

</form>

mysqli_close($db);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.