Jump to content
Larry Ullman's Book Forums

wasabitakoyaki

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by wasabitakoyaki

  1. This is my php code to handle an html form

     

    ########################################

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD

    XHTML 1.0 Transitional//EN"

    "http://www.w3.org/TR/xhtml1/DTD/

    xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml"

    xml:lang="en"

    lang="en">

    <head>

    <meta http-equiv="Content-Type"

    content="text/html; charset=utf-8" />

    <title>Form Feedback</title>

    </head>

    <body>

    <?php # Script 2.2 -handle_form.php

     

    $name = $_REQUEST['name'];

    $email = $_REQUEST['email'];

    $comments = $_REQUEST['comments']

     

    echo "<p>Thank you, <b>$name</b>,

    for the following comments:<br />

    <tt>$comments</tt></p>

    <p>We will reply to you at

    <i>$email</i>.</p>\n";

     

    ?>

    </body>

    </html>

     

    #################################

     

    And this is my form that I am trying to handle

     

    <!DOCTYPE html PUBLIC "-//W3C//

    DTD XHTML 1.0 Transitional//EN"

    "http://www.w3.org/TR/xhtml1/DTD/

    xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/

    1999/xhtml" xml:lang="en"

    lang="en">

    <head>

    <meta http-equiv="Content-Type"

    content="text/html;

    charset=utf-8" />

    <title>Simple HTML Form</title>

    <style type="text/css"

    title="text/css" media="all">

    label {

    font-weight: bold;

    color: #300ACC;

    }

    </style>

    </head>

    <body>

    <!-- Script 2.1. - form.html -->

     

    <form action="handle_form.php"

    method="post">

     

    <fieldset><legend>Enter your

    information in the form below:

    </legend>

     

    <p><label>Name: <input type="text"

    name="name size="20" maxlength=

    "40" /></label></p>

     

    <p><label>Email Address: <input

    type="text" name="email" size="40"

    maxlength="60" /></label></p>

     

    <p><label for"gender">Gender:

    </label><input type="radio"

    name="gender" value="M" /> Male

    <input type="radio" name="gender"

    value="F" /> Female</p>

     

    <p><label>Age:

    <select name="age">

    <option value="0-29">Under 30

    </option>

    <option value="30-60">Between 30

    and 60</option>

    <option value="60+">Over 60

    </option>

    </select></label></p>

     

    <p><label>Comments: <textarea

    name="comments" rows="3" cols="40">

    </textarea></label></p>

     

    </fieldset>

     

    <p align="center"><input type=

    "submit" name="submit" value=

    "Submit My Information" /></p>

     

     

    </form>

     

    </body>

    </html>

     

    #########################

     

    But when I try and submit the form it gives me this error

     

    HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

     

    It works with just php code (i.e. the numbers.php) from chapter 1 and with loading the form itself and I have been trying to google to find out what is wrong but I am stumped.

     

    Thanks for any help

×
×
  • Create New...