PHP code for Contact form
Need a Website? Contact Us Now!
If you have a contact form and wondering how to redirect the contact form to be redirected to your mail id, you can follow the below steps to send all your contact form details to your mail id.
Fist let us create a php folder called thankyou.php or you can do this later too, you can open dreamweaver and within the <body> tag of your code copy and paste the below php codes.
echo $name.”. We will get back to you soon.”;
$Message = ” Form Details \n\n”;
$Message .= ” Name : $name \n”;
$Message .= ” E-mail : $email \n”;
$Message .= ” Phone : $phone \n”;
$Message .= ” Message : $msg \n”;
mail(“email@example.com”, “Website Visitors”, $Message , “From: $email\n”);
You can change the mail id where it says, “firstname.lastname@example.org” to your mail id, now you can save the file in dreamweaver as thankyou.php
With the above step being completed, you have a file called thankyou.php.
2. While you open your contact.html page, you will see in the design part, the form which has the fields above:
while you click on each field inside, and check the code, you should have the same name as in the form, for example, when you click inside the Name: box of your contact form in your contact.html, the TextField must say “name” as described in your thankyou.php form, also check for all the 4 field names here.
After you do this, you must tag your form to your thankyou.php file and how to do this, you can see the below image and explaination:
click on the <form#form6> at the footer of your dreamweaver and in the action part where I have circled in red you must click on the yellow folder besides that and tag your form with the thankyou.php and also select the target as _blank, now save your files and upload them to your server.
Go to the contact page in your browser ie: http://bestwebdesignz.com/contact.html and put in your name, email, phone and message there and submit the form, you should receive the details filled in the contact form to your mail id as mentioned in the php code.
That’s it, you now know how to write a PHP code for a Contact form.
- phpBB Tutorials
- How to install phpBB from fantastico.
- PhpBB Templates
- How to backup your database in phpBB
- How to ban users from accessing and using the forums in phpBB
- How to use word censoring in phpBB
- How to configure your phpBB installations.
- How to create a forum in phpBB
- How to create a new topic in phpBB
- How to disallow usernames in phpBB
- How to edit your profile in phpBB.
- How to configure forum permissions in phpBB
- How to manage group permissions in phpBB
- How to manage groups in phpBB
- How to manage a forum in phpBB
- How to send a mass email to users in phpBB
- How to setup a poll when starting a new topic in phpBB
- How to send private messages in phpBB
- How to edit a users profile in phpBB
- How to prune forums in phpBB
- How to register as a user in phpBB
- How to manage ranks in phpBB
- How to reply to an existing topic in phpBB.
- How to use the search tool in phpBB
- How to manage smilies in phpBB
- How to manage styles in phpBB
- How to manage user permissions in phpBB
- How to know if your hosting supports PHP
- PHP code for Contact form
- Contact PHP forms in Yahoo Smallbusiness Server
Posted in phpBB Tutorials | No Comments »