|
|
|
|
![]() ![]() |
Dec 6 2004, 04:18 PM
Post
#1
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 933 Joined: 24-August 04 Member No.: 892 |
Here is a simple script to make a contact form with PHP.
First off you make a simple contact form, insert the following into any page: CODE <form method="post" action="form.php"> Name:<input name="name" type="text" id="name"><br> Email:<input name="email" type="text" id="email"><br> Subject:<input name="subject" type="text" id="subject"><br> Message:<textarea name="comments" id="textarea"></textarea><br> <input type="submit" name="Submit" value="SUBMIT"> </form> Now make a page called 'form.php' and inser the following only! No html tags! CODE <?php //Declare the variables $recipient = "YOUR@EMAIL.HERE"; $message = "name: $name email: $email subject: $subject message: $comments"; //Contents of form $name=$_POST['name']; $email=$_POST['email']; $subject=$_POST['subject']; $comments=$_POST['comments']; //mail() function sends the mail mail($recipient,$subject,$message); //This line sends to thankyou page when finished header("Location: thankyou.php"); ?> To finnish you just need to make a page called 'thankyou.php' to thank the person for contacting you. I hope this will help someone out there! |
|
|
|
Dec 6 2004, 09:44 PM
Post
#2
|
|
|
Newbie [Level 3] ![]() ![]() ![]() Group: Members Posts: 48 Joined: 26-October 04 From: Kalisz, Poland Member No.: 1,971 |
It is all in documanation in www.php.net
|
|
|
|
Dec 6 2004, 10:13 PM
Post
#3
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 933 Joined: 24-August 04 Member No.: 892 |
what is all in the docs? the whole of it? or how to do it?
|
|
|
|
Dec 7 2004, 01:18 AM
Post
#4
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 339 Joined: 2-December 04 From: Atlanta, GA Member No.: 2,516 |
Whatever it is, it's not as good as what you put down, simple, and small-sized.
|
|
|
|
Dec 7 2004, 07:13 AM
Post
#5
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 158 Joined: 5-December 04 From: Canada Member No.: 2,567 |
QUOTE(thablkpanda @ Dec 7 2004, 01:18 AM) Whats not simple about his coding? it looks very simple to me and doesnt use anything advanced... I dont think you will find anything easier unless you just download a contact script and use that instead of simply coding it yourself **Edit, im sorry, its 3am here right now and i have been misreadin stuff alot in the past 2 hours, i thought u were complaing about his code Off to bed for me, ZZzzzzzZZzzz |
|
|
|
Dec 14 2004, 12:45 AM
Post
#6
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 339 Joined: 2-December 04 From: Atlanta, GA Member No.: 2,516 |
QUOTE(icedragn @ Dec 7 2004, 02:13 AM) Whats not simple about his coding? it looks very simple to me and doesnt use anything advanced... I dont think you will find anything easier unless you just download a contact script and use that instead of simply coding it yourself **Edit, im sorry, its 3am here right now and i have been misreadin stuff alot in the past 2 hours, i thought u were complaing about his code Off to bed for me, ZZzzzzzZZzzz Lol, now that's hillarious, and I just got back to replying to this message... i feel kinda stupid. And no I wasn't complaining (duh) and uh, it would be pointless to tell you to go to bed earlier, but you should do it newayz. |
|
|
|
Dec 14 2004, 01:33 AM
Post
#7
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 101 Joined: 3-December 04 Member No.: 2,521 |
That's perfect for what i want to do! Where does the mail function come from though, is it OS specific? Anyone know? Wondering about how to set that up?
|
|
|
|
Dec 14 2004, 01:51 AM
Post
#8
|
|
|
Cambodian Web & Software Developer. ![]() ![]() ![]() ![]() Group: Members Posts: 59 Joined: 16-November 04 From: Cambodia Member No.: 2,307 |
// send email to
function sendmail($from,$subject,$body) { $to="youremail@youremail.com"; $headers = "MIME-Version: 1.0 \r \n"; $headers .= "Content-type: text/html; charset=iso-8859-1 \r \n"; $headers .= "To: $to \r \n"; $headers .= "From: $sender \r \n"; $send=mail($to,$subject,$body,$headers); if(isset($send)){ return 1; } else { return 0;} } //Contents of form $email=$_POST['email']; $subject=$_POST['subject']; $comments=$_POST['comments']; //mail() function sends the mail if(sendmail($email,$subject,$comments)==1){header("Location: thankyou.php");} else{echo "Sorry! we got a problem with sending email, please try again later";} This is what i have done. I hope you love it. Thanks & Best Regards, Dorei http://khmerneed.trap17.com find out for more source code with a small and easy stuff. |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|