Button for insert operation is not working
code: html
<form method= "post " action="">
Experiment name : <input type="text" name="exp_name" placeholder="Enter exp Name" Required>
<br/>
Exp Date : <input type="text" name="exp_date" placeholder="Enter date" Required>
<br/>
sbst name : <input type="text" name="sb_name" placeholder="Enter sb name" Required>
<br/>
sbst id : <input type="text" name="sb_id" placeholder="Enter sb id" Required>
<br/>
Exp TIME : <input type="text" name="exp_time" placeholder="Enter time" Required>
<br/>
machine : <input type="text" name="machine_name" placeholder="Enter mach name" Required>
<br/>
incharge : <input type="text" name="exp_incharge" placeholder="Enter incharge" Required>
<br/>
team : <input type="text" name="exp_team" placeholder="Enter team" Required>
<br/>
<input type="submit" name="submit" value="Submit">
</form>
php:
<?php
include 'db_con.php';
$conn = OpenCon(); // establish connection
echo "Connected Successfully";
if(isset($_POST['submit']))
{
$Exp_name = $_POST['exp_name'];
$Exp_date = $_POST['exp_date'];
$Subset_name = $_POST['sb_name'];
$Subset_id = $_POST['sb_id'];
$Exp_time = $_POST['exp_time'];
$machine = $_POST['machine_name'];
$Exp_Incharge = $_POST['exp_incharge'];
$Exp_team = $_POST['exp_team'];
$sql = "INSERT INTO pre_exp_details (
Exp_Name,
Exp_Date,
Subset_Name,
Subset_ID,
Exp_Time,
Machine,
Exp_Incharge,
Exp_Team)
VALUES (
'$Exp_name ',
'$Exp_date',
'$Subset_name',
'$Subset_id',
'$Exp_time',
'$machine',
'$Exp_Incharge',
'$Exp_team')";
if(mysqli_query($conn, $sql)){
echo "Records inserted successfully.";
} else{
echo "ERROR: Could not able to execute $sql. ". mysqli_error($conn);
}
mysqli_close($conn);
}
?>