<?php
session_start();
require_once "db-connect.php";


//++++++++++++++++++++++++++++++++++++++++++++++++++//
//			contact us
//++++++++++++++++++++++++++++++++++++++++++++++++++//
if(isset($_POST['contact'])){
	$name = $_POST['name'];
	$email = $_POST['email'];
	$tel = $_POST['tel'];
	$msg = $_POST['msg'];
	
	//$date =  jdate("Y/m/d");
	$date = date("Y-m-d");
	
	
	
	try{

		$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
		/*******************************************************************************/
		$stmt = $conn->prepare("INSERT INTO `contact`( `name`, `tel`, `email`, `msg`, `date`) VALUES (:a1,:a2,:a3, :a4 , :a5 )");
		$stmt->bindparam(":a1",$name);
		$stmt->bindparam(":a2",$tel);
		$stmt->bindparam(":a3",$email);
		$stmt->bindparam(":a4",$msg);
		$stmt->bindparam(":a5",$date);
		$stmt->execute();
		echo 'اطلاعات ثبت شد';
    	return;
}//end try
	catch(PDOException $e){

		echo "خطا : " . $e->getMessage();
		$err = $e->getMessage();
		echo 'متاسفانه اطلاعات شما ثبت نشد';

	}//end catch
	
}
?>