This is a php awnser....
Create another page called send.php and link it in the form tag
<form name="contact" method="post" action="send.php" id="form">
If you want this to link back add this in also in the head
Code:
<meta http-equiv="refresh" content="20;url=PAGESENTFROM" />
The if statments you can change around so that they are required fields or not.
PHP Code:
<?php
$visitor = $_POST['name'];
$visitormail = $_POST['email'];
$notes = $_POST['message'];
$phone = $_POST['phone'];
if (eregi('http:', $notes)) {
die ("Don't try that!! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>The e-mail address you entered was not correct.</h2>\n";
die ("<br />Your question has not been submitted. This page will bring you back<br />in 20 seconds or you may use your browsers back menu to resubmit.\n</div>
</div>
</body>
</html>");
}
if($phone == "")
{
echo "Please enter your phone number. In the phone field"
}
if($notes == "")
{
echo "Please enter your message. In the message field";
die ("<br />You may use your browsers back button or this page will bring you back in 20 seconds.</div>
</div>
</body>
</html>");
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<br />Please Fill in all of the information.\n";
die ("<br />You may use your browsers back button or this page will bring you back in 20 seconds.</div>
</div>
</body>
</html>");
}
$sendata="Email Address:". $visitormail;
$todayis = date("l, F j, Y, g:i a") ;
$q="Message from ". $visitor . " ". $notes . "Submitted:" . $todayis . "Phone:" . $phone;
$attn = $attn ;
$subject = "Message from website";
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";
mail("travelinchucks@gmail.com", $subject, $sendata, $q);
$File = "questions.txt";
$Handle = fopen($File, 'a');
$Data = "<br />From:" . $visitor . "<br />Submitted on:" . $todayis . "<br />" . $notes . "<br /><hr />";
fwrite($Handle, $Data);
fclose($Handle);
?>
<p>
Date: <?php echo $todayis ?>
<br />
Thank You <?php echo $visitor ?> for your question we will awnser you shortly by email and may post your question on our site.
<br />
Your question:
<?php $notesout = str_replace("\r", "<br/>", $notes); echo $notesout; ?>
has been submitted.
<br /><br /><h1>You may use your browsers back button or wait 20 seconds and you will be redirected.</h1>
</p>
If that doesn't work try putting this
Code:
<input type="submit" value="Send Your Message" style="text-align:center;" />
in place of
Code:
<span><a href="#" onClick="document.getElementById('form').reset()">clear</a></span><img src="images/spacer.gif" alt="" width="26" height="1"/><span><a href="#" onClick="document.getElementById('form').submit()">send</a></span>
Bookmarks