Ok guys, I’ve been doing a contact form, and have got some simple questions (simple for you guys, I’ve been struggling for days!)
Number 1: How do I make a contact form ensure all the boxes are filled in?
Number 2: How can I create a little pop-up that says if all the boxes AREN’T filled in?
Number 3: How can I get my PHP mailing form to redirect back to the main page, after a successful submit?
Below is the coding for the PHP form, and a bit of the HTML coding on the contact page.
Thanks in advance guys, and a beer to the first one to help me ?
PHP FORM:
[quote]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “
<html>
<head>
<title>Enquiry Submitted</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
</head>
<body>
<?php
if(isset($_POST[‘submit’])) {
$to = “sales@*********”;
$subject = “Website Enquiry”;
$name_field = $_POST[‘name’];
$email_field = $
$message = $_POST[‘message’];
$body = “From: $name_fieldn E-Mail: $email_fieldn Message:n $message”;
echo “Thank you for submitting your enquiry, you will be rediverted back to the main page in 5 seconds”;
mail($to, $subject, $body);
} else {
echo “Error, your message has not been sent. Sorry.!”;
}
?>
<p>Please click <a href=http://www.**************>here</a> if you are not re-diverted.
</body>
</html>
HTML FORM:
[quote]
<form method=”POST” action=”mailer.php”>
<input type=”text” name=”name” size=”19″>
<br>
</p>
<p>
<input type=”text” name=”email” size=”19″>
</p>
<p><br>
<br>
<textarea rows=”9″ name=”message” cols=”30″></textarea>
<br>
<br>
<input type=”submit” value=”Submit” name=”submit”>
</form>
Once again, thanks for taking the time to read my thread, I really appreciate it.
Matt