Jump to content

Recommended Posts

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>

 

Link to comment
https://forums.phpfreaks.com/topic/166736-solved-php-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.