May 22, 2012, 11:08:56 PM
Pages: [1]   Go Down
  Send this topic  |  Print  
Share this topic on FacebookShare this topic on DiggShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter Topic: PHP / HTML Mail Form. (Basic )  (Read 615 times)
0 Members and 1 Guest are viewing this topic.
B.SkiLLs
Xtreme Administrator
Resident Badass
*****

Reputation: +56/-0
Offline Offline

Posts: 2365



View Profile WWW
« on: July 25, 2009, 03:14:07 AM »

This tutorial is how to create a simple email form for a web site.

First, place this form code below in a HTML file or on the HTML web page you want it on thats already set up on your server.

The HTML part of it:


Code:

<form method="post" action="sendmail.php">

Email:
<br />
<input name="email" type="text" /><br />

Message:
<br />
<textarea name="message" rows="15" cols="40">
</textarea>

<br />
<input type="send" /></form>




Now to the PHP part of it:


When the submit input button is clicked , it calls the file "sendmail.php", as you can see in the above form code


So Lets do that file now.

Now create a php file and paste this code below in the file and name it  "sendmail.php"



Code:
<?php
  $email 
$_REQUEST['email'] ;
  
$message $_REQUEST['message'] ;

  
mail"YOUR MAIL""MY WED SITE MAIL",
    
$message"From: $email" );
?>



Thanks for sending your mail, we will get back to you as soon as possible






Theres three things you must change, the email address in the second part of code that says YOUR MAIL in which the email is going to be sent to. (meaning your main email address you want your web mail to be sent to)

and then the subject of the email that way you know it is coming from your website mail form, so also change where it says MY WEB SITE MAIL to whatever you want the title to be so you can recognize it.

I also added a section of text underneath the sendmail.php coding that says:

"Thanks for sending your mail, we will get back to you as soon a possible"

You can change that also to whatever you like , so you are sending them back a Thanks for sending mail to your site. Thats always nice to do and professional .







Logged




Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to: