<?php
$conn = mysqli_connect('localhost','root','','demodata') OR die("Error: " . mysqli_error($conn));
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
$id=0;
if(isset($_POST['save'])){
if(!empty($_POST['empName']) && !empty($_post['empState']))
{
$name= $_POST['empName'];
$state=$_post['empState'];
$query = "Insert into employee(empId,empName,empState)values(?,?,?)";
$stmt = $conn->prepare($query);
if($stmt->execute())
{
#alert massg;
}
$stmt->close();
$conn->close();
}
header("location:index.php");
}
?>