Okay here is a sample
<?php
//Do some validation
if ($submit) {
if (!$Name) {
$error[] = "Missing Name";
}
if (!$Address) {
$error[] = "Missing Address";
}
if (!$email) {
$error[] = "Missing email";
}
if ($email) {
if ( eregi("(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)", $email, $arr_vars)
or !eregi ("^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$", $email, $arr_vars)) {
$error[] = "Bad email";
}
}
}//End if submit
if (count($error) == 0) {
//Do some query or mail() function here
print "Successfule Submission";
}
?>
<head>
<title>Add a listing</title>
</head>
<body>
<form method="post" action="<?php print $PHP_SELF; ?>">
<table width=400 cellspacing="0" cellpadding="4">
<?php if ($submit && (count($error) > 0)) { ?>
<tr>
<td colspan=2>Sorry there were the following problems with your submission:<ul>
<?php
for ($j=0;$j < count($error);$j++) {
print "<li><b>". $error[$j] ."</b>\n";
}
?>
</ul>
</td>
</tr>
<?php } ?>
<?php if (($submit && (count($error) > 0)) || !$submit) { ?>
<tr>
<td> Business or Organization Name:</td>
<td><input type="text" name="Name" size="20" maxlength="100" value="<?php print $Name; ?>"></td>
</tr>
<tr>
<td> Street Address:</td>
<td><input type="text" name="Address" size="20" maxlength="100" value="<?php print $Address; ?>"></td>
</tr>
<tr>
<td>* Email:</td>
<td><input type="text" name="email" size="20" maxlength="100" value="<?php print $email; ?>"></td>
</tr>
<tr><td colspan=2><input type="submit" name="submit" value="Submit"></td></tr>
<?php } ?>
</td></tr>
</table>
</form>
</body>