Script 2.2 Form Processing

An example of a separate file for processing a submitted form.

Output

Thank you, , for the following comments:

We will reply to you at .

Source
<?php
 # Script 2.2 - form feedback  handle_form.php

// Create a shorthand for the form data:
$name = (isset($_REQUEST['name']))?$_REQUEST['name']:null;
$email = (isset($_REQUEST['email']))?$_REQUEST['email']:null;
$comments = (isset($_REQUEST['comments']))?$_REQUEST['comments']:null;
/* Not used: 
$_REQUEST['age']
$_REQUEST['gender']
$_REQUEST['submit']
*/

// Print the submitted information:
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";

?>