Log in

View Full Version : HTML Feedback Form



tonq
08-27-2006, 06:23 AM
IS it possible to create an HTML page that users can fill out and the page will email you the user's input? are there any JavaScripts?


ton

jscheuer1
08-27-2006, 06:42 AM
You could work something out using HTML and javascript but, it would not be all that reliable due to the inevitable dependence on how email is configured (sometimes not at all, sometimes in a way incompatible with any sort of set up like this that uses HTML and javascript) by each user. The best approach is to use a server side mail form. Your host may have something available for you to use, ask them first. There are also quite a number of third party mail forms available on the web. Some are free, some are not.

mburt
08-31-2006, 02:40 PM
This is an example of the mail function in PHP:

contact.htm


<form id="emailform" method="post" action="post.php">
Your E-mail:
<br><input name="email" id="email">
<br>Subject:
<br><input name="subject" id="subject">
<br>Message:
<br><textarea cols="40" rows="10" name="message" id="message"></textarea>
<br><input type="submit" value="Submit" id="button" onclick="check()">
</form>


and then the PHP

post.php


<?php
$to = "mburt_2005@hotmail.com";
$subject = $_POST["subject"];
$body = "From: $_POST[email]\n$_POST[message]";
$headers = "From: $_POST[email]" . "\r\n" .
"Reply-To: $_POST[email]" . "\r\n" .
"X-Mailer: PHP/" . phpversion();
if (mail($to,$subject,$body,$headers)) {
echo "The e-mail was successfully sent.";
}
else {echo "E-mail was not sent. Please check all of the information you entered."}
echo "<br><input type='button' value='Back' onclick='window.history.back()'>"
?>



I use this method on my website:
http://mburt.mb.funpic.org/contact.php