[h1]Creating A Contact Form in PHP[/h1]
Save the following code as send.php . The following code is what will send the email contents for the form, to the specified email address.
<?php
echo "Thank you for your input, if I want to I'll get back to you soon... ";
$email = "your email";
$subject = "subject";
$name = $_POST['name'];
$commentemail = $_POST['email'];
$comments = $_POST['comments'];
mail("$email", "$subject", "$name
$commentemail
$comments");
?>
The only thing you need to do is change where it says $email="your email"; and put your email address.
Next we will write the form.
<form method="post" action="send.php">
<table border="0" celpadding="0" cellspacing="0">
<tr>
<td>
Name:
</td>
<td>
<input type="text" name="name" value="" size="32" maxlength="40">
</td></tr><tr><td>
E-mail:
</td><td>
<input type="text" name="email" value="" size="32" maxlength="40">
</td></tr><tr><tr><td>
Comments:
</td><td>
<textarea rows="4" cols="24" name="comments" maxlength="300"></textarea>
</td></tr></table>
<br /><br /><input type="submit" value="Send"></td></tr>
</form>
Save the form as whatever you want, upload the form to your site and give it a try. Later on i will begin writting forms/contact methods which require all fields to be filled out, For now we're keeping everything basic and simple.
Date Posted: July 09, 2005, 02:41:45 AM
Coming soon a modified version of the contact form. What we will have is a simple contact form with all fields required to fill out.
Basic features of the form is not many but here they go..
1. The Persons First and last name must be entered.
2. They must specify their gender.
3. They must select their age group (I'm not sure if i'm going to add this yet)
4. They must provide a valid email address so you can contact them back.
5. And ofcourse they must add some type of comments.
This form will be done either tonight or tomorrow, whenever i have the time.