smQQkin Posted July 21, 2009 Share Posted July 21, 2009 I am just learning PHP and am trying to complete the following form "titlehelp.html". However, when you click on the "Submit" button it throws an error (line 22 titlehelp.php) in mine. Any ideas or help would be appreaciated. Titlehelp.html </head> <body> <center> <table width=""550"> <tr bgcolor="- #FF99932><td align="center"><BR> <h3> The ThrillerGuide.com<BR> "What was the name of that thriller?"<BR> Form</h3></td></tr> <tr><td> Did you once read an unforgettable thriller, but now you can't remember the name? Fill out as many of the fields below as you can, press the butt to submit, and we'll search our sources and e-mail you back. </td></tr></table> </center> <FORM method= post action="titlehelp.php"> <P>First name: <input type="text" size=30 name="FirstName"> <P>Last name: <input type="text" size=30 name="LastName"> <P>Your Email Adress: <input type="text" size=30 name="Email"> <P>In approximately what year did the action of the book occur? <input type="text" size=4 name="Year"> <P>Can you remember any settings from the book? <input type="text" size=30 name="Setting"> <P>The gender of the protagonist(s) was: <br> <ul> <input TYPE="radio" NAME="Gender" VALUE=1>Female<br> <input TYPE="radio" NAME="Gender" VALUE=2>Male<br> <input TYPE="radio" NAME="Gender" VALUE=3>One of each other<br> <input TYPE="radio" NAME="Gender" VALUE=4>Two males<br> <input TYPE="radio" NAME="Gender" VALUE=5>Two Females<br> </ul> <P>When the book first came out, it was:<br> <ul> <input TYPE="radio" NAME="Status" VALUE=1>A bestseller<br> <input TYPE="radio" NAME="Status" VALUE=2>A critic's darling<br> <input TYPE="radio" NAME="Status" VALUE=3>Neither<br> <input TYPE="radio" NAME="Status" VALUE=4>I dont know<br> </ul> <P>Please tell us anthing else you can remember about this title (plot. characters, settings, cover, movie versions, etc.): <br><textarea NAME="Other" rows=6 cols=50></textarea> <P><input type="submit" name="Submit"> </body> </html> Titlehelp.php <body> <?php // If you wished, you could also save this information to a database $LastName = $_POST['LastName']; $FirstName = $_POST['FirstName']; $Year = $_POST['Year']; $Setting = $_POST['Setting']; $Gender = $_POST['Gender']; $Status = $_POST['Status']; $Other = $_POST['Other']; $formsent = mail('[email protected]', 'What was the name of that thriller?', "Request from: $LastName $FirstName\r\nYear: $Year\r\nSetting(s): $Setting\r\nProtagonist gender: $Gender\r\nBook status: $Status\r\nOther identifying characteristics: $Other", "From: $Email\r\nBounce-to: example.example"); if ($formsent) { echo "<P>Hi, $FirstName. We have received your request for help, and will try to respond within 24 hours. Thanks for visiting ThrillerGuide.com!"; } else ( echo "I'm sorry, there's a problem with your form. Please try again."; ) ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/166736-solved-php-error/ Share on other sites More sharing options...
trq Posted July 21, 2009 Share Posted July 21, 2009 What is the error exactly? You don't seem to even have 22 lines within titlehelp.php Quote Link to comment https://forums.phpfreaks.com/topic/166736-solved-php-error/#findComment-879221 Share on other sites More sharing options...
smQQkin Posted July 21, 2009 Author Share Posted July 21, 2009 I get the following error: Parse error: syntax error, unexpected T_ECHO in /home/content/s/m/Q/smQQkin/html/Test/titlehelp.php on line 22 Quote Link to comment https://forums.phpfreaks.com/topic/166736-solved-php-error/#findComment-879229 Share on other sites More sharing options...
Alex Posted July 21, 2009 Share Posted July 21, 2009 } else ( echo "I'm sorry, there's a problem with your form. Please try again."; ) should be } else { echo "I'm sorry, there's a problem with your form. Please try again."; } The { and } were ( ) Quote Link to comment https://forums.phpfreaks.com/topic/166736-solved-php-error/#findComment-879235 Share on other sites More sharing options...
co.ador Posted July 21, 2009 Share Posted July 21, 2009 Yea The braces After if, Else, elseif always uses brackets Quote Link to comment https://forums.phpfreaks.com/topic/166736-solved-php-error/#findComment-879237 Share on other sites More sharing options...
smQQkin Posted July 21, 2009 Author Share Posted July 21, 2009 Thanks Alex... That worked perfect. Quote Link to comment https://forums.phpfreaks.com/topic/166736-solved-php-error/#findComment-879239 Share on other sites More sharing options...
Alex Posted July 21, 2009 Share Posted July 21, 2009 Thanks Alex... That worked perfect. Make the topic as solved. There's a button on the topic page, bottom left. Quote Link to comment https://forums.phpfreaks.com/topic/166736-solved-php-error/#findComment-879245 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.