Hi All
I've checked around all kinds of sites, but to be honest I'm literally just learning PHP and not a clue what people are saying. Basically all I want to do is make some fields required before the form is submitted. At the moment all it does is go to the header:location page when it's submitted! I've probably put something in the wrong place.
My html code is -
<form method="POST" action="contact.php">
name*<br>
<input type="text" name="name" size="30">
<br>
<br>
email <br>
<input type="text" name="email" size="30">
<br>
<br>
message* <br>
<textarea rows="9" name="message" cols="30"></textarea>
<br>
<br>
<input type="submit" value="Get In Touch" name="submit">
</form>
and my PHP code is -
<?php ini_set ("POP","mail.conceptcreativedesigns.co.uk");ini_set ("sendmail_from","info@conceptcreativedesigns.co.uk");
if(isset($_POST['submit'])) {
$to = 'postmaster@conceptcreativedesigns.co.uk';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset-ISO-8859-1\r\n";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message_field = $_POST['message'];
$subject = 'New Message From - '.$name_field;
$message = "<html><body>";
$message .= "<b>From:</b> ".$name_field;
$message .= "<br><br><b>Email Address:</b> ".$email_field;
$message .= "<br><br><b>Message:</b> ".$message_field;
$message .="</body></html>";
echo '<script type="text/javascript">
window.onload=function(){alert("Thank you, your message has been sent.");}
</script>';
mail($to, $subject, $message, $headers);
} else {
echo "I'm sorry, your request had not been submitted. Please try again.";
}
header("Location: contact_submit.html#thankyou");
?>
I copied and pasted most of it and got it to where I need it, except for the 'required' bit.
Any suggestions as to what I can include and where to include it would really help!
Thanks