Reputation: 10686
I made a PHP script for a form, but dont't know how to get it to work...How do i put the PHP in the page and make it active? I am a total noob to php, so i have no idea. Do you put the php inside the HTML doc, or make a separate PHP document and link to that? The PHP thing is here, in case you need it.
<?php
$ToEmail = '[email protected]';
$EmailSubject = 'Site contact form ';
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "Name: ".$_POST["name"]."<br>";
$MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";
$MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."<br>";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
?>
Upvotes: 0
Views: 86
Reputation: 208032
The easiest thing to do would be to create a separate PHP page (e.g. send.php) and then have the form in your HTML page use it in the action attribute (e.g. <form method="post" action="send.php">
)
Upvotes: 4
Reputation: 733
put it at the top of the .php file which contains the html code if you want it to work
Upvotes: -3