Helps? o___o

+1 Savad Dekrup · October 16, 2014
<?php
if (isset($_POST['email']) && isset($_POST['fn']) && isset($_POST['ln']) && isset($_POST['message'])){

$email = htmlentities($_POST['email']);
$firstName = htmlentities($_POST['fn']);
$lastName = htmlentities($_POST['ln']);
$message = htmlentities($_POST['message']);

if (filter_var($email, FILTER_VALIDATE_EMAIL)){
$to = "knightnevergiveup@hotmail.com"; //Your Email Address
$subject = "Feed Back From " . $email; //Email Subject 
$headers = "From " . $firstName . " " . $lastName; //From
mail($to,$subject,$message,$headers); //Your Email, Email Subject, Email Message, Email From

echo "Yup!";
}else{
echo "Email is invalid. Please try again"; 
}




}else{
echo "Nope.";
}
?>

<!DOCTYPE html>
<html>
<head></head>

<body>
<form method="POST" action="<?php $_SERVER['PHP_SELF']; ?>" autoComplete="off">
Email:<br/><input type="text" placeHolder="Email Address" name="email"/><br/>
First Name:<br/><input type="text" placeHolder="First name" name="fn" /><br/>
Last Name:<br/><input type="text" placeHolder="Last name" name="ln" /><br/>
Message:<br/> <textarea placeHolder="Message..." name="message" cols="20"rows="5"></textarea><br/>
<input type="submit" value="Submit"/>
</form>
</body>

</html>


I don't know why it doesn't work. Can anyone tell me why? o___o...

Post a Reply

Replies

Oldest  Newest  Rating
0 Savad Dekrup · October 16, 2014
So, the problem was the script works but somehow I didn't recieve the message.
0 Mayowa Olaitan · October 17, 2014
Check the mail function
0 Savad Dekrup · October 18, 2014
Check what? I mean, what do you mean by that... 
  • 1

PHP

126,417 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators