Hello guys can help me? about how I disabled a checkbox if the value of checkbox is already in database I have inserted value of 1A,1B in database, but suddenly all the checkbox is disabled :( here's my simple code
<?php
//Connections
$server_name='localhost';
$username='root';
$password='admin';
$db_name='matnogreservationv2';
$con= mysqli_connect($server_name, $username, $password, $db_name);
if(mysqli_connect_errno())
{
echo 'Failed..!!'.mysqli_connect_errno();
}
>?
//code for disabling checkbox
$resulta= mysqli_query($con,"SELECT * FROM seat WHERE SeatStatus = 1");
$display = mysqli_num_rows($resulta);
$con->query($display);
$disable = $display ? 'disabled="disabled"': '';
<input type="checkbox" name="seat[]" id="1A" value="1A" <?php echo $disable; ?>>
<label for="1A">1A</label>
<input type="checkbox" name="seat[]" id="1B" value="1B" <?php echo $disable; ?>>
<label for="1B">1B</label>
<input type="checkbox" name="seat[]" id="1C" value="1C"<?php echo $disable; ?>>
<label for="1C">1C</label>
<input type="checkbox" name="seat[]" id="1D" value="1D"<?php echo $disable; ?>>
<label for="1D">ID</label>
<input type="checkbox" name="seat[]" id="1E" value="1E"<?php echo $disable; ?>>
<label for="1E">1E</label>
<input type="checkbox" name="seat[]" id="1F" value="1F"<?php echo $disable; ?>>
<label for="1F">1F</label>
Aucun commentaire:
Enregistrer un commentaire