Also a newbie. I'm moving my site from my free server because they don't accept commercial websites. Prob is now I gotta do all the forms myself. I have the php form2mail figured out pretty much, now I just need to get it to check for required fields...anyone know just how to do that?
Heres the form:
<form method="post" action="form2mail.php" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="_From" value="sch0ol_0f_hard_kn0cks@yahoo.com">
<input type="hidden" name="_To" value="sch0ol_0f_hard_kn0cks@yahoo.com">
<input type="hidden" name="_Subject" value="Ad Placement">
<input type="hidden" name="_Location" value="form.php">
<table cellpadding="4" width="533" cellspacing="0" border="0">
<tr>
<td valign="TOP" width="40%"><font><p>Name: </p></font></td>
<td valign="TOP" width="60%"><input type="text" name="name" maxlength="20" width="81" /></td>
<td valign="TOP" width="40%"><font><p>Last Name: </p></font></td>
<td valign="TOP" width="60%"><input type="text" name="lname" maxlength="20" width="81" /></td>
</tr>
<tr>
<td><font><p>Address: </p></font></td>
<td><input type="text" name="address" maxlength="20" width="81" /></td>
<td><font><p>City: </p></font></td>
<td><input type="text" name="city" maxlength="20" width="81" /></td>
</tr>
<tr>
<td><font><p>Postcode: </p></font></td>
<td><input type="text" name="post_code" size="5" maxlength="5" width="81" /></td>
<td><font><p>Phone: </p></font></td>
<td><input type="text" name="phone" maxlength="20" width="81" /></td>
</tr>
<tr>
<td><font><p>E-Mail: </p></font></td>
<td><input type="text" name="email" size="20" maxlength="50" width="881" /></td>
</tr>
<tr>
<td><font><p>Contact per:</p></font></td>
<td><font><input type="radio" name="contact" value="E-Mail" checked />e-mail
<input type="radio" name="contact" value="Phone" />phone
<input type="radio" name="contact" value="Post" />post</font>
</td>
</tr>
<tr>
<td></td>
<td><p><input type="reset" name="reset" value="Reset" /></p></td>
<td><p><input type="submit" name="submit" value="Send" /></p></td>
</tr>
</table>
</form>
Heres the code:
<?php
$message="The form ".$_POST{"_Location"}." was filled in on ".date("m-d-Y H:i:s (D) (O)")."<HR>";
foreach ($_POST as $key => $value) {
if($key{0} != "_") $message .= "<B>$key</B>: ".nl2br(htmlspecialchars($value))."<BR>";
}
mail($_POST{"_To"}, $_POST{"_Subject"}, $message, "From: ".$_POST{"_From"}."\nContent-type: text/html\n");
?>
Now how can I get it to check for required fields and bring the visitor back to the form page to fill them in if blank?[/php_man]