71
Promote your site! / Re: Visit my site
« Last post by olidev on August 10, 2018, 02:55:18 AM »You can either use some template for contact page and then use some free php contact form script or you can create a custom php contact form on your own. I would go for the latter because these free scripts might have some security vulnerabilities. You can easily create a PHP contact form. Just create html form, create and configure MySQL database and then connect it with your PHP file. Create contact form php file and add the following script in it.
Code: [Select]
<?php
require_once("config.php");
if((isset($_POST['your_name'])&& $_POST['your_name'] !='') && (isset($_POST['your_email'])&& $_POST['your_email'] !=''))
{
require_once("contact_mail.php<strong>");
</strong>
$yourName = $conn->real_escape_string($_POST['your_name']);
$yourEmail = $conn->real_escape_string($_POST['your_email']);
$yourPhone = $conn->real_escape_string($_POST['your_phone']);
$comments = $conn->real_escape_string($_POST['comments']);
$sql="INSERT INTO contact_form_info (name, email, phone, comments) VALUES ('".$yourName."','".$yourEmail."', '".$yourPhone."', '".$comments."')";
if(!$result = $conn->query($sql)){
die('There was an error running the query [' . $conn->error . ']');
}
else
{
echo "Thank you! We will contact you soon";
}
}
else
{
echo "Please fill Name and Email";
}
?>
Recent Posts