It's VERY basic and doesn't have any error handling which I need to get around to doing.
---
1. Open your scripting program (Notepad, Context, Dreamweaver).
2. Insert the following code:
CODE
<?php
$to = "youremail@yourisp.com";
$sub = "Subject of the Email Here";
?>
3. Make sure no other code is in that file. If you used Dreamweaver or a similar editor make sure you remove the excess tags. Replace the two parts within the quote marks to reflect your settings. Mine is:
CODE
<?php
$to = "spikeh@spikeh.com";
$sub = "Spikeh.com Contact Email";
?>
4. Save this file as "config.php"
5. Open the page that you want to add the contact form to.
6. Insert this code exactly where you want the form to appear:
CODE
<?php
include ("config.php");
?>
<form action="contact.php" mehod="post">
Your Email Address:<br>
<input type="text" name="useraddr" size="30">
<br>
Message:<br>
<textarea name="comments" cols="50" rows="7"> </textarea>
<br>
<br>
<input type="submit" value="Send Form"> <input name="Reset" type="reset" value="Reset">
</form>
<?php
if (isset($comments)) {
$msg = $comments;
$from = "From: $useraddr";
// $msg .= "You may contact the sender at the following email address: $useraddr";
mail($to,$sub,$msg,$from);
echo "Your message has been sent.";
}
?>
7. You then need to save this file with a .php extension. If the file was origionally "contact.htm" then it now needs to be "contact.php" or the php section just won't work.
8. Upload the config.php file and the contact.php file to your site and test it out.
---
I hope people find this useful. If anyone would like to build upon this and make it better then please do by all means. Just let me know what you did and give me a copy of the code.
discuss this topic to forum
