Using the given below php script, I connect to database and insert data in it. But the data getting inserted in my database table Except Status insput. It is also not throwing any error. Where is my code wrong?
Suggest me Changes.
localhost/index.php?branch_id=1
index.php Code:
<?php
<form action="index.php" method="POST">
<?php
if (isset($_GET['branch_id'])) {
$branch_id = $_GET['branch_id'];
$query = "SELECT * FROM branch_list WHERE branch_id='$branch_id' LIMIT 1";
$query_run = mysqli_query($con, $query);
foreach ($query_run as $row) {
?>
<input type="hidden" name="b_id" value="<?php $row['branch_id']; ?>">
<input type="text" value="<?php echo $row['branch_name']; ?>" name="b_name">
<input type="email" value="<?php echo $row['branch_email']; ?>" name="b_email">
<input type="number" value="<?php echo $row['branch_phone']; ?>" name="b_phone">
<input type="text" value="<?php echo $row['branch_address']; ?>" name="b_address">
<select name="b_status" class="form-select">
<?php
if ($row['branch_status'] == 1) {
?>
<option selected>Active</option>
<option>Deactivated</option>
<?php } else {
?>
<option>Active</option>
<option selected>Deactivated</option>
<?php } ?>
</select>
<button type="submit" name="edit_office"> Update Details</button>
<?php }
} ?>
</form>
Trying to code a simple script which alter already present data in a Database table, but Data is Not getting Update Can Someone Pls Check the Code and Suggest me Changes.