Email Form PHP Coding
Posted: Mon Sep 20, 2010 4:14 pm
Hi new here so not sure if in the right forum, however I am using a email form in php and want to find a way so when the error messages in the form open, they will open in a pop up rather than having hit the back button to go back to the form? Do I need to add some JS to make this happen or is it a matter of adding some additional code somewhere?
This is the code im using in Code for sendemail.php:
Any help will be appreciated
Regards
Gary
This is the code im using in Code for sendemail.php:
Code: Select all
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$subject = $_POST['subject'];
$phone = $_POST['phone'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
if (eregi('http:', $notes)) {
die ("Please enter your message before you try submitting the form. ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Go Back - Please enter a valid e-mail address.</h2>\n";
$badinput = "<h2>Email not Valid something is wrong with the address you enterd.</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Go Back and fill in all fields correctly before you try submitting the form.</h2>\n";
die ("go back and try again");
}
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = "WEB SITE MAIL" ;
$notes = stripcslashes($notes);
$message = "$todayis [EST] \n
Subject: $subject \n
From: $visitor ($visitormail)\n
Phone: $phone \n
Message: $notes \n
IP Address: IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";
mail("admin@myemail.co.uk", $subject, $message, $from);
?>Any help will be appreciated
Regards
Gary