Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <meta http-equiv="Content-Language" content="en-us">
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
- <title>Players / Foursome</title>
- </head>
- <body>
- <div align="center">
- <table border="0" width="44%" height="646">
- <tr>
- <td valign="top">
- <table border="0" width="100%" style="border-bottom-width: 0px">
- <tr>
- <td valign="top" style="border-bottom-style: none; border-bottom-width: medium"> <b><font size="5">Players
- / Foursome</font></b></td>
- </tr>
- </table>
- <?php
- $errors = array(); // array to hold error messages
- $ertags = array(); // array to hold names of erroneous fields
- // ===========================================================================
- // When the form is submitted:
- // a. all fields: 'sanitize' by removing code tags
- // b. mandatory fields: check for validity and content (some)
- // ===========================================================================
- if (isset($_POST['_submit'])) {
- // ----------------------------------------------------
- // remove harmful code tags from all $_POST variables
- // ----------------------------------------------------
- foreach ($_POST as $key => $val) {
- $_POST[$key] = trim(strip_tags($val));
- }
- // ----------------------------------------------------
- // Verify existence and content of mandatory fields:
- //
- // Golfers Name Golfers Name
- // Guests Name Guests Name
- // Company Company
- // Home Address Home Address
- // Phone Phone
- // Fax Fax
- // Email E-mail (valid e-mail address)
- // Room Room
- // Smoking Smoking
- // Shirt Shirt
- // ----------------------------------------------------
- //
- // Golfers Name
- if (!isset($_POST['Golfers Name']) OR $_POST['Golfers Name'] == '') {
- $errors[] = "Golfers Name invalid";
- $ertags[] = 'Golfers Name';
- }
- // Guests Name
- if (!isset($_POST['Guests Name']) OR $_POST['Guests Name'] == '') {
- $errors[] = "Guests Name invalid";
- $ertags[] = 'Guests Name';
- }
- // Company
- if (!isset($_POST['Company']) OR $_POST['Company'] == '') {
- $errors[] = "Company invalid";
- $ertags[] = 'Company';
- }
- // Home Address
- if (!isset($_POST['Home Address']) OR $_POST['Home Address'] == '') {
- $errors[] = "Home Address invalid";
- $ertags[] = 'Home Address';
- }
- // Phone
- if (!isset($_POST['Phone']) OR $_POST['Phone'] == '') {
- $errors[] = "Phone invalid";
- $ertags[] = 'Phone';
- }
- // Fax
- if (!isset($_POST['Fax']) OR $_POST['Fax'] == '') {
- $errors[] = "Fax invalid";
- $ertags[] = 'Fax';
- }
- // Email (check also if valid e-mail address)
- if (!isset($_POST['Email']) OR !preg_match("/^[0-9a-z]+(([\.\-_])[0-9a-z]+)*@[0-9a-z]+(([\.\-])[0-9a-z-]+)*\.[a-z]{2,4}$/i", $_POST['Email'])) {
- $errors[] = "E-mail address invalid";
- $ertags[] = 'Email';
- }
- // Room
- if (!isset($_POST['Room']) OR $_POST['Room'] == '') {
- $errors[] = "Room invalid";
- $ertags[] = 'Room';
- }
- // Shirt
- if (!isset($_POST['Shirt']) OR $_POST['Shirt'] == '') {
- $errors[] = "Shirt invalid";
- $ertags[] = 'Shirt';
- }
- // -------------------------------------------------------
- // ERRORS FOUND: print out and re-display form
- // -------------------------------------------------------
- if ($errors) {
- echo '<div style="margin-left:250px;font-size:12px;font-family:Tahoma;color:red;">';
- echo '<u><b>The following errors were encountered (see highlighted fields):</b></u><ul><li>';
- echo implode('</li><li>',$errors);
- echo '</li></ul></div>';
- }
- else {
- // -------------------------------------------------------
- // NO ERRORS FOUND: continue and construct e-mail message
- // -------------------------------------------------------
- // echo '<pre>'; print_r($_POST); echo '<br>';
- include("convertPost.php");
- exit;
- }
- } // END if isset _submitted
- // ==================================================================================
- // (Re) Display the form
- // ==================================================================================
- ?>
- <hr size="1" color="#000000">
- <div align="center">
- <form name="myForm" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
- <table border="0" cellspacing="10" cellpadding="3">
- <tr>
- <td style="border-style: solid; border-width: 1px" valign="top" width="344">
- <table border="0" width="331" cellspacing="0" cellpadding="0" height="327">
- <tr>
- <td valign="top" height="20" width="331" colspan="2">
- <p align="center"><b><font size="4">Player
- One</font></b></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Golfers Name:</b><br>
- <input type="text" name="P1GN" size="25" tabindex="1" value="<?php echo (isset($_POST['Golfers Name'])) ? $_POST['Golfers Name'] : ""; ?>"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Guests Name:</b><br>
- <input type="text" name="P1GUN" size="25" tabindex="2" value="<?php echo (isset($_POST['Guests Name'])) ? $_POST['Guests Name'] : ""; ?>"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Company:</b><br>
- <input type="text" name="P1C" size="30" tabindex="3" value="<?php echo (isset($_POST['Company'])) ? $_POST['Company'] : ""; ?>"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Home Address:</b><br>
- <input type="text" name="P1HA" size="48" tabindex="4" value="<?php echo (isset($_POST['Home Address'])) ? $_POST['Home Address'] : ""; ?>"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="175"><b>
- <font size="2">Phone:<br>
- </font></b><font size="2">
- <input type="text" name="P1P" size="20" tabindex="5" value="<?php echo (isset($_POST['Phone'])) ? $_POST['Phone'] : ""; ?>"></font></td>
- <td valign="top" height="37" width="169">
- <font size="2"><b>Fax:</b><br>
- <input type="text" name="P1F" size="20" tabindex="6" value="<?php echo (isset($_POST['Fax'])) ? $_POST['Fax'] : ""; ?>"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Email:</b><br>
- <input type="text" name="P1EM" size="38" tabindex="7" value="<?php echo (isset($_POST['Email'])) ? $_POST['Email'] : ""; ?>"></font></td>
- </tr>
- <tr>
- <td valign="top" height="35" width="331" colspan="2">
- <b><font size="2">Room:<br>
- <select size="1" name="P1R">
- <option selected>Select Bed Size</option>
- <option>King</option>
- <option>Double</option>
- <?php echo (isset($_POST['Room'])) ? $_POST['Room'] : ""; ?></select>
- <select size="1" name="P1SM">
- <option selected>Smoking or Non-Smoking
- </option>
- <option>Smoking</option>
- <option>Non-Smoking</option>
- <?php echo (isset($_POST['Smoking'])) ? $_POST['Smoking'] : ""; ?></select></font></b></td>
- </tr>
- <tr>
- <td valign="top" height="50" width="331" colspan="2">
- <b><font size="2"><br>
- T-Shirt:<br>
- <select size="1" name="P1TS">
- <option selected>Select Your Size</option>
- <option>XXL</option>
- <option>XL</option>
- <option>Large</option>
- <option>Medium</option>
- <option>Small</option>
- <?php echo (isset($_POST['Shirt'])) ? $_POST['Shirt'] : ""; ?></select></font></b></td>
- </tr>
- </table>
- </td>
- <td style="border-style: solid; border-width: 1px" valign="top">
- <table border="0" width="331" cellspacing="0" cellpadding="0" height="326">
- <tr>
- <td valign="top" height="19" width="331" colspan="2">
- <p align="center"><b><font size="4">Player
- Two</font></b></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Golfers Name:</b><br>
- <input type="text" name="T8" size="25"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Guests Name:</b><br>
- <input type="text" name="T9" size="25"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Company:</b><br>
- <input type="text" name="T10" size="30"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Home Address:</b><br>
- <input type="text" name="T11" size="48"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="174"><b>
- <font size="2">Phone:<br>
- </font></b><font size="2">
- <input type="text" name="T12" size="20"></font></td>
- <td valign="top" height="37" width="170">
- <font size="2"><b>Fax:</b><br>
- <input type="text" name="T13" size="20"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Email:</b><br>
- <input type="text" name="T14" size="38"></font></td>
- </tr>
- <tr>
- <td valign="top" height="35" width="331" colspan="2">
- <b><font size="2">Room:<br>
- <input type="checkbox" name="C10" value="ON">King
- <input type="checkbox" name="C11" value="ON">Double
- <input type="checkbox" name="C12" value="ON">Smoking
- <input type="checkbox" name="C13" value="ON">Non-Smoking</font></b></td>
- </tr>
- <tr>
- <td valign="top" height="50" width="331" colspan="2">
- <b><font size="2"><br>
- T-Shirt:<br>
- <input type="checkbox" name="C14" value="ON">XXL
- <input type="checkbox" name="C15" value="ON">XL
- <input type="checkbox" name="C16" value="ON">Large
- <input type="checkbox" name="C17" value="ON">Medium
- <input type="checkbox" name="C18" value="ON">Small</font></b></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td style="border-style: solid; border-width: 1px" valign="top" width="344">
- <table border="0" width="331" cellspacing="0" cellpadding="0" height="327">
- <tr>
- <td valign="top" height="20" width="331" colspan="2">
- <p align="center"><b><font size="4">Player
- Three</font></b></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Golfers Name:</b><br>
- <input type="text" name="T15" size="25"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Guests Name:</b><br>
- <input type="text" name="T16" size="25"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Company:</b><br>
- <input type="text" name="T17" size="30"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Home Address:</b><br>
- <input type="text" name="T18" size="48"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="173"><b>
- <font size="2">Phone:<br>
- </font></b><font size="2">
- <input type="text" name="T19" size="20"></font></td>
- <td valign="top" height="37" width="171">
- <font size="2"><b>Fax:</b><br>
- <input type="text" name="T20" size="20"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Email:</b><br>
- <input type="text" name="T21" size="38"></font></td>
- </tr>
- <tr>
- <td valign="top" height="35" width="331" colspan="2">
- <b><font size="2">Room:<br>
- <input type="checkbox" name="C19" value="ON">King
- <input type="checkbox" name="C20" value="ON">Double
- <input type="checkbox" name="C21" value="ON">Smoking
- <input type="checkbox" name="C22" value="ON">Non-Smoking</font></b></td>
- </tr>
- <tr>
- <td valign="top" height="50" width="331" colspan="2">
- <b><font size="2"><br>
- T-Shirt:<br>
- <input type="checkbox" name="C23" value="ON">XXL
- <input type="checkbox" name="C24" value="ON">XL
- <input type="checkbox" name="C25" value="ON">Large
- <input type="checkbox" name="C26" value="ON">Medium
- <input type="checkbox" name="C27" value="ON">Small</font></b></td>
- </tr>
- </table>
- </td>
- <td style="border-style: solid; border-width: 1px" valign="top">
- <table border="0" width="331" cellspacing="0" cellpadding="0" height="327">
- <tr>
- <td valign="top" height="20" width="331" colspan="2">
- <p align="center"><b><font size="4">Player
- Four</font></b></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Golfers Name:</b><br>
- <input type="text" name="T22" size="25"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Guests Name:</b><br>
- <input type="text" name="T23" size="25"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Company:</b><br>
- <input type="text" name="T24" size="30"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Home Address:</b><br>
- <input type="text" name="T25" size="48"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="174"><b>
- <font size="2">Phone:<br>
- </font></b><font size="2">
- <input type="text" name="T26" size="20"></font></td>
- <td valign="top" height="37" width="170">
- <font size="2"><b>Fax:</b><br>
- <input type="text" name="T27" size="20"></font></td>
- </tr>
- <tr>
- <td valign="top" height="37" width="331" colspan="2">
- <font size="2"><b>Email:</b><br>
- <input type="text" name="T28" size="38"></font></td>
- </tr>
- <tr>
- <td valign="top" height="35" width="331" colspan="2">
- <b><font size="2">Room:<br>
- <input type="checkbox" name="C28" value="ON">King
- <input type="checkbox" name="C29" value="ON">Double
- <input type="checkbox" name="C30" value="ON">Smoking
- <input type="checkbox" name="C31" value="ON">Non-Smoking</font></b></td>
- </tr>
- <tr>
- <td valign="top" height="50" width="331" colspan="2">
- <b><font size="2"><br>
- T-Shirt:<br>
- <input type="checkbox" name="C32" value="ON">XXL
- <input type="checkbox" name="C33" value="ON">XL
- <input type="checkbox" name="C34" value="ON">Large
- <input type="checkbox" name="C35" value="ON">Medium
- <input type="checkbox" name="C36" value="ON">Small</font></b></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <input type="submit" value="Submit Form" />
- <input type="reset" value="Reset Form Fields" />
- <input type="hidden" name="_submit" value="1" />
- </form>
- </div>
- </td>
- </tr>
- </table>
- </div>
- <p> </p>
- </body>
- </html>
- <?php
- ////////////////////////////////////////////////////////////////////////////////
- /**
- * Color the description of a field to red when an error has been found.
- */
- function is_err($field) {
- global $ertags;
- if (in_array($field, $ertags))
- echo " style='color:red;' ";
- else
- echo "";
- }
- ?>
If you need the other two files please message me and I can provide them, the error or missing symbol has to be on this page.
Thanks
Chris