This script needs to be run on a web server to work. Open this file in your text editor and read the comment that begins with "TO TEST THIS SCRIPT" for additional information.
This is a very simple PHP script that displays each bit of information that was sent when form.html
was submitted (by using the "Create Acount" button). The left column of the table below lists the name
attribute of each form field as defined in form.html
. The right column shows each field's value as sent with the submitted form.
In a more useful script, you might store this information in a MySQL database, or send it to your email address.
Important Note: The sample PHP code in this file is meant for demonstration purposes only and is simple by design, and as a result, it doesn't include the security checks that a bulletproof script would include. Given that, I don't recommend you use it as-is on your site. If you do intend to use a script like this, I recommend consulting PHP books and other resources to learn how to check submitted form values for malicious data before you write the values to the screen or to a database, or send them via email, as well as any other methods that will make it secure.
The script also does not check each to see if the user provided information for each form field.
Field Name | Value(s) | No data was submitted. | ";
} else { /* Data was submitted, so show it in the page. */
foreach ($_POST as $key => $value) {
/* Cleans up quoted values. See:
http://us2.php.net/manual/en/function.get-magic-quotes-gpc.php
http://us2.php.net/manual/en/function.stripslashes.php
*/
if ($key != 'email_signup') {
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
}
/* Check the form field and print its value in a table row */
if ($key == 'email_signup') { // True if one of the Email checkboxes at end
if (is_array($_POST['email_signup'])) { // True if a checkbox checked
// Print the name of the checkbox form field and the value
foreach ($_POST['email_signup'] as $value) {
print "
---|---|
$value | "; print "on"; print " |
$key | $value |
$key | $value |
picture | $picture_name |