dimanche 12 avril 2015

how can i fix a php script that stops html page from displaying

I have a PHP script in an HTML page that is stopping my entire HTML page from displaying its contents when I remove the following lines, it works perfectly:



if($_POST){
mail($to, $subject $message, $header);
$feedback = 'mail submitted';
}


What could be the problem?


Here is the entire code:



<?php
$to = 'example@gmail.com';
$subject = 'From Your Website';

$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];

$message = <<<EMAIL
Hello this is $name my email is


$message

EMAIL;
$header = '$email';
if($_POST){
mail($to, $subject $message, $header);
$feedback = 'mail submitted';
}
?>

//body starts here
<!DOCTYPE html>
<html>
<head>
<title>Test mail</title>
</head>
<body>
<p id="feedback"><?php echo $feedback; ?></p>
<form action="#" method="post" >
<input type="text" name="name" />
<input type="email" name="email" />
<textarea type="text" name="message"></textarea>
<input type="submit" name="su`enter code here`bmit" />
</form>
</body>
</html>

Aucun commentaire:

Enregistrer un commentaire