Choose fontsize:
Welcome, Guest. Please login or register.
Did you miss your activation email?

 

Pages: [1]   Go Down
  Print  
Author Topic: PHP - "Creating A Contact Form"  (Read 7001 times)
0 Members and 1 Guest are viewing this topic.
Member
*

Karma: 2
Gender: Male
Posts: 138



View Profile WWW
« on: July 16, 2005, 01:45:40 PM »
[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.

Code:
<?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.

Code:
<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.
« Last Edit: March 02, 2006, 08:22:11 PM by SKETCHi » Logged
Tutorial Writer
*

Karma: 9
Gender: Male
Posts: 1,254


I'm mighty tighty whitey and I'm smugglin' plums.


View Profile WWW
« Reply #1 on: July 16, 2005, 02:01:39 PM »
Sounds good man, I'll probably use this thanks much for the code
Logged
Veteran
*

Karma: -18
Gender: Male
Posts: 311


i came, i saw, i left


View Profile
« Reply #2 on: July 19, 2005, 02:53:02 PM »
awesome tut, ive been trying to find out how to do this, thanks
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:      

MickM [ In: 2403 // Out: 2118 ] BioRUST [ In: 2951 // Out: 2428 ] Pixel-Designz [ In: 1183 // Out: 2917 ] Graphic Addicts Topsites [ In: 2435 // Out: 3389 ] SMF Topsites [ In: 0 // Out: 2021 ] SaberFusion [ In: 553 // Out: 1622 ] 2DValley [ In: 1846 // Out: 1412 ] SweDesignz [ In: 865 // Out: 1647 ]
Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Phobos design by Bloc | XHTML | CSS


Google visited last this page Yesterday at 10:14:15 PM