Hi I have a simple form that when submitted I get sent a email with the results, however I want the 'Name' and 'Email' fields to be mandatory for the user to fill in, without which they cannot submit the form, if they try a message comes up saying they need to complete the mandatory fields.
Can someone please help or show me how I can achieve this. Thanx
this is my PHP script
<?php
$result = "Garner International: Website Enquiry Form\r\n\r\n";
$result .= "Name: " . $POST['q1'] . "\r\n";
$result .= "Professional Title: " . $POST['q2'] . "\r\n";
$result .= "Company Name: " . $POST['q3'] . "\r\n";
$result .= "Email Address" . $POST['q4'] . "\r\n";
$result .= "Comments: " . $_POST['q5'] . "\r\n";
if ($POST['q4']) {
$headers = "From: $POST[q1] <$_POST[q4]>\r\n\r\n";
} else {
$headers = "From: No Name given <anonymous@yourserver.com>\r\n\r\n";
}
$sendit = mail("shush@freshlemon.co.uk", "Garner International: Website Enquiry Form", $result, $headers) or die("Something went wrong");
echo "<meta http-equiv='refresh' content='0; url=thank.html'>";
die;
?>