- Messages
- 179
- Reaction score
- 89
- Points
- 888
Hello CCM!
Today I’m Going To Show A Quick Tutotial On How To Make A Simple PHP Contact Form!
So Let’s Get Into It.
First You Will Need To Open A IDE Of Your Choice!
I Highly Recommend Sublime Or NotePad++
Once You Have Opened Your IDE Of Choice Create A File Called
contact.php
In That File Add The Following Code
Now Once You Have Done That, Save The File!
But Hold Up, Were Not Done Yet
Now You Need To Create Another File Called send.php
In That File Add The Following Code (Edit It To Your Needs & Add Your Email Address In The $to Part)
Now Save That File Aswell And Upload Them To Your Website / Server
Now Send A Test Message And Make Sure It All Works!
That’s All For This Quick Tutorial!
Thanks For Looking Guys, Hope You Have A Nice Day!
If You Need Any Help Feel Free To Contact Me!
PS. Sorry About The Formatting, I Wrote This On My Phone Using An App
Today I’m Going To Show A Quick Tutotial On How To Make A Simple PHP Contact Form!
So Let’s Get Into It.
First You Will Need To Open A IDE Of Your Choice!
I Highly Recommend Sublime Or NotePad++
Once You Have Opened Your IDE Of Choice Create A File Called
contact.php
In That File Add The Following Code
HTML:
<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="send.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
Now Once You Have Done That, Save The File!
But Hold Up, Were Not Done Yet
Now You Need To Create Another File Called send.php
In That File Add The Following Code (Edit It To Your Needs & Add Your Email Address In The $to Part)
PHP:
<?php
// Contact subject
$subject ="$subject";
// Details
$message="$detail";
// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";
// Enter your email address
$to ='[email protected]';
$send_contact=mail($to,$subject,$message,$header);
// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>
Now Save That File Aswell And Upload Them To Your Website / Server
Now Send A Test Message And Make Sure It All Works!
That’s All For This Quick Tutorial!
Thanks For Looking Guys, Hope You Have A Nice Day!
If You Need Any Help Feel Free To Contact Me!
PS. Sorry About The Formatting, I Wrote This On My Phone Using An App
Last edited: