My question is very simple. but I am struggling with it too much. The problem is once I hit the submit button that page should redirect to some other page. Kindly just tell me what I have done wrong? Because I have tried everything.
Code:
Update-docket.php
<?php
//error_reporting(0);
$link = mysqli_connect("localhost", "home_db", "root", "");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Escape user inputs for security
$sql = 'SELECT * FROM prod_details';
$result = mysqli_query($link,$sql);
while ($row = mysqli_fetch_array($result))
{
$Quantity1 = $_POST['p_'.$row['id']. ''];
$id = $row['id'];
$store = $row['rstore'];
// echo $store;
foreach ($_POST as $key => $value)
{}
if(!empty($Quantity1)) {
$query="update prod_details SET rdocket='$Quantity1' WHERE id='$id'";
if(mysqli_query($link, $query)) {
header('Location: /docket-details.php');
exit();
} else {
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
}
}
docket-details.php
<form class="form-horizontal" action="update-docket.php" method="post" name="myform" autocomplete="off">
<button type='submit' name='submit' class='btn c-theme-btn c-btn-square c-btn-uppercase c-btn-bold'>Submit</button>
Please help!!!