Welcome to Creative Nation!

Welcome to Creative Nation, . Feel free to browse our forums and help yourself to all our free tutorials, images, and recources!


To download this script go back to article »

Member Login

Lost your password?

Not a member yet? Sign Up!

[PHP] Contact form guide

The next generation of web design.

You are not connected. Please login or register

[PHP] Contact form guide

Go down  Message [Page 1 of 1]

1 [PHP] Contact form guide on 8/24/2011, 1:43 pm



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
<form method="POST" action="mailer.php">
  <input type="text" name="name" size="19"><br>
  <input type="text" name="email" size="19"><br>
  <textarea rows="9" name="message" cols="30"></textarea>
  <input type="submit" value="Submit" name="submit">

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


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.

2 Re: [PHP] Contact form guide on 8/24/2011, 2:45 pm


Thank you very much. I will try this ASAP. Going to get my domain name sometime this week!

3 Re: [PHP] Contact form guide on 8/25/2011, 7:48 am




Glad it has helped


4 Re: [PHP] Contact form guide on 8/25/2011, 1:49 pm


So I tried to do this to an index page on my PC and it didn't work. Why?

5 Re: [PHP] Contact form guide on 8/26/2011, 11:08 am



You'll need to have PHP installed...

6 Re: [PHP] Contact form guide on 8/26/2011, 2:50 pm


Hmm guess I won't be able to do this since I have no idea how to do that.

Sponsored content

Back to top  Message [Page 1 of 1]

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


Free forum | © PunBB | Free forum support | Contact | Report an abuse | Forumotion.com.