![]() Equipping You to Communicate Effectively | support CMN & share a library of 19K+ images, videos, etc Go Pro! |
![]() | ![]() |
| |||||||
| Website Coding Discussions PHP, MySQL, Java, Javascript, ASP, etc. |
![]() |
| | Thread Tools | Search this Thread | Rate Thread | Display Modes |
| |||
| I thought I fixed this problem with some scripts but I'm still getting empty contact messages. Can someone look at my code? I added this to my contact page ----I also added a sendmail.php to stop the empty messages.---- $from_name = $_POST['name']; $from_email = $_POST['email']; $phone_number = $_POST['phone']; $message = $_POST['message']; $to_name = "Webmaster"; $to_email = "my email address"; $subject = "Website Contact Message Received"; $today = date("n/j/Y g:ia"); $ip_addr = $_SERVER['REMOTE_ADDR']; $body = "Website Contact Message Received ----------------------------------------- From: $from_name E-mail: $from_email Phone: $phone_number Message: $message -------------------------------------------------------- Message received on $today from $ip_addr "; mail($to_email, $subject, $message, "From: $from_email"); ?> |
| |||
| The code didn't show on my first post. Not sure how to post code. I took out the <'s and the >'s around the script and the !-- Code:
script type="text/javascript"
!--
function checkinput() {
var ret = false; // set to false unless the criteria is met
if (document.formname.name.value == "") {
alert("Please enter your name before submitting the form. Thanks.");
} else if (document.formname.message.value == "") {
alert("Please enter a message before submitting the form. Thanks.");
} else {
ret = true; // message and from_name are not blank, continue with submit
}
return ret;
} // end function checkinput
//--
/script |
![]() |
|
| Tags |
| contact, empty, message, php, spam |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
| |
Register Now for FREE! | |||||
| |