Direct access

Are you a new member from Brush-Land or by Forumotion? You can have many options for your account! Register right now on the new Brush-Land!

Login

  • I have forgot my password | Register

Register

  • Weak
    Normal
    Strong
     



Puregroups.inc


You are not connected. Please login or register

Contact form guide


Irian
Contact form guide Empty
Published by Irian
Post published on Fri Oct 21, 2011 6:29 pm

http://puregroups.co.cc



Hello and welcome to my first tutorial on creative nation,
Here is how to make a basic php contact form with Name, E-Mail address and Content fields.

Step 1 : Add this to your html page
Code:
<form method="POST" action="mailer.php">
  <input type="text" name="name" size="19"><br>
  <br>
  <input type="text" name="email" size="19"><br>
  <br>
  <textarea rows="9" name="message" cols="30"></textarea>
  <br>
  <br>
  <input type="submit" value="Submit" name="submit">
</form>


The code you see above shows the display elements.

Step 2: Create a php file called "mailer.php" please ensure that it is in the same directory as your html page.

Step 3 : The php file should contain

Code:

<?php
if(isset($_POST['submit'])) {
$to = "you@you.com";
$subject = "Contact Form Response";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
 
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
 
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "Something Went wrong, please try again!";
}
?>



But where it says you@you.com change it to your email address.

There you have it, your own php contact form Smile
I will do a line by line breakdown and guide with pictures soon.


 



Similar topics

-

» [FORM] Have a request

Permissions in this forum:
You cannot reply to topics in this forum

ForumotionPuregroupsKalleankafansite - Ankornas paradisContact form guide Eng1011Kalleankafansite - Ankornas paradis