Okay, I was able to make this work with a simplier form - but now with a bigger one, it won't work. It won't show the form at all. I've tried to fix this for an hour, but with no luck. Here is the code:
<?php
function show_form($name="",
$company="",
$address="",
$state="",
$zip="",
$dateofevent="",
$workphone="",
$homephone="",
$fax="",
$cell="",
$time="",
$coatcheck="",
$cars="",
$people="",
$rsvpdate="",
$billingaddress="",
$billingstate="",
$billingzip="",
$hear="",
$comments="") { ?>
<form action="<?php echo $PHP_SELF; ?>" method="POST" name="Request">
<div class="left">Name:</div><input name="name" type="text" value="<? echo $name; ?>"/><br />
<div class="left">Company:</div><input name="company" type="text" value="<? echo $company; ?>"/><br />
<div class="left">Street Address:</div><input name="address" type="text" value="<? echo $address; ?>"/><br />
<div class="left">State:</div><input name="state" type="text" value="<? echo $state; ?>"/><br />
<div class="left">Zip:</div><input name="zip" type="text" value="<? echo $zip; ?>"/><br />
<div class="left">Date of Event:</div><input name="dateofevent" type="text" value="<? echo $dateofevent; ?>"/><br />
<div class="left">Work Phone:</div><input name="workphone" type="text" value="<? echo $workphone; ?>"/><br />
<div class="left">Home Phone:</div><input name="homephone" type="text" value="<? echo $homephone; ?>"/><br />
<div class="left">Fax:</div><input name="fax" type="text" value="<? echo $fax; ?>"/><br />
<div class="left">Cell:</div><input name="cell" type="text" value="<? echo $cell; ?>"/><br />
<p> </p>
<div class="left">Time:</div><input name="time" type="text" value="<? echo $time; ?>"/><br />
<p> </p>
<div class="left">Coat Check:</div><input name="coatcheck" type="text" value="<? echo $coatcheck; ?>"/><br />
<div class="left">Anticipated # of Cars:</div><input name="cars" type="text" value="<? echo $cars; ?>"/><br />
<div class="left">Anticipated # of People:</div><input name="people" type="text" value="<? echo $people; ?>"/><br />
<div class="left">RSVP Date:</div><input name="rsvpdate" type="text" value="<? echo $rsvpdate; ?>"/><br />
<p> </p>
<div class="left"> </div><b>Billing:</b><br />
<div class="left">Street Address:</div><input name="billingaddress" type="text" value="<? echo $billingaddress; ?>"/><br />
<div class="left">State:</div><input name="billingstate" type="text" value="<? echo $billingstate; ?>"/><br />
<div class="left">Zip:</div><input name="billingzip" type="text" value="<? echo $billingzip; ?>"/><br />
<p> </p>
<div class="left">How did you hear about us?</div><textarea name="hear" cols="35" rows="5"><? echo $hear; ?></textarea><br />
<div class="left">Other Comments:</div><textarea name="comments" cols="35" rows="5"><? echo $comments; ?></textarea><br />
<div class="left"> </div><input name="submit" type="submit" value="Submit"/><br />
</form>
<? }
if ($submit)
{
//submit was pressed and validate form here
if(empty($name) or
empty($company) or
empty($address) or
empty($state) or
empty($zip) or
empty($dateofevent) or
empty($workphone) or
empty($homephone) or
empty($fax) or
empty($cell) or
empty($time) or
empty($coatcheck) or
empty($cars) or
empty($people) or
empty($rsvpdate) or
empty($billingaddress) or
empty($billingstate) or
empty($billingzip) or
empty($hear) or
empty($comments))
{
//form did not pass validation, show form again
echo "<p>You did not fill in all the required fields, please try again.<p>";
show_form($name,
$company,
$address,
$state,
$zip,
$dateofevent,
$workphone,
$homephone,
$fax,
$cell,
$time,
$coatcheck,
$cars,
$people,
$rsvpdate,
$billingaddress,
$billingstate,
$billingzip,
$hear,
$comments);
}
else
{
//form passes validation, process and send email here...
}
}
else
{
//show form for the first time
showform();
}
?>