Hi there, I am wondering how to insert validation into this code:
[php]<?php
error_reporting(E_ALL);
ini_set(‘display_errors’, ‘On’);
// Featured first in thec ontact html page (contact.html) is name, so we define it as a variable to be pulled
$name = “name”;
// Next comes email address of the person sending the message
$sender_email= “sender_email”;
// the phone number of the person sending the message
$phone = “phone”;
//the subject of the message
$subject =“subject”;
// The message
$message=“message”;
//Building a message that is sent, out of several variables:
$mailcontent = 'Name: '.$name."\n"
."\n"
.'Email Address: '.$sender_email."\n"
."\n"
.'Message: '.$message."\n";
// From
$header=“from: $name $subject <$sender_email>”;
// Enter your email address
$to =‘[email protected]’;
$send_contact=mail($to,$subject,$mailcontent,$header);
// Check, if message sent to your email
// display message “We’ve recived your information”
if($send_contact){
header( ‘Location: contactthankyou.php’ ) ;
}
else {
echo “ERROR”;
}
?>[/php]
And then,
For the Javascript, someone helped me out and created this, but there seems to be an error on line 5!
(where it says this: var form = document.getElementById(“contactform”); )
[code][/code]
Any help, especially with adding in php validation would be very helpful!
Thx!