<?php
if (isset($doover))
unset($doover);
if (isset($_POST['submit')) {
$errors="";
$contact_name = $_POST['ContactName'];
$contact_address = $_POST['Address'];
$contact_city = $_POST['City'];
$contact_region = $_POST['StateOrRegion'];
$contact_postcode = $_POST['PostalCode'];
$contact_country = $_POST['Country'];
$contact_email = $_POST['EmailAddress'];
$contact_phone = $_POST['Phone'];
if(!isset($contact_name))
$errors .= "Name, ";
if(!isset($contact_address))
$errors .= "Address, ";
if(!isset($contact_city))
$errors .= "City, ";
if(!isset($contact_region))
$errors .= "Region, ";
if(!isset($contact_postcode))
$errors .= "Postal Code, ";
if(!isset($contact_country))
$errors .= "Country, ";
if((!isset($contact_email)) or (!strstr($contact_email,"@")))
$errors .= "E-mail, ";
if(!isset($contact_phone))
$errors .= "Phone, ";
if (strlen($errors) != 0) {
echo "You did not complete the following fields ".substr($errors,0,-2).".<br>\n";
$doover=true;
} else {
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]
=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
// do stuff with the form
}
}
if ((!isset($_POST['submit')) or (!isset($doover)) {
// display form with @$contact_name, @$contact_address, @$contact_city, @$contact_region, etc.
// as the values so they will be filled in with the partial input from the already submitted, but incomplete form.
}
?>