<?php 

$servername= "localhost";
$username ="ruscmm_user";
$password ="ruscmm#123@";
$dbname = "ruscmm_db";
$conn = mysqli_connect($servername, $username, $password);
mysqli_select_db($conn, $dbname);


if(isset($_POST['btn_submit']))
{
	$name = mysqli_real_escape_string($conn, $_POST['name']);
   $email = mysqli_real_escape_string($conn, $_POST['email']);
   $messg = mysqli_real_escape_string($conn, $_POST['messg']);
   $phone = mysqli_real_escape_string($conn, $_POST['phone']);
   
	$sql = mysqli_query($conn, "INSERT INTO register(name, email, messg, phone)values('$name', '$email', '$messg', '$phone')");
	
	if($sql)
	{
		$_SESSION["data"] = "ok";
		$_SESSION["msg"] = "data is successfully";
		header("location:thanks.php");
		exit;
	}else
	{
		$_SESSION["data"] = "ok";
		$_SESSION["msg"] = "data is not successfully";
		header("location:index.php");
		exit;
	}
}


?>