php - Disable or enable checkbox, based on value in table -
if $partner has value no, want disable checkbox checkpartner
if $partner has value yes, want enable checkbox checkpartner
grtz benny
<?php $result3 = mysqli_query($con,"select partner, vip event eventid = ".$row['eventid']." "); while($row = mysqli_fetch_array($result, mysql_both)) $partner = $row['partner']; if ($partner = 'no') { } ?> <form action="" method="post" name="registerform1" id="registerform1"> <h6>partner :<input type="checkbox" name="checkpartner"/>
you'll have add attribute 'disabled' html-element 'input'. based on condition - in case - this.
<?php // inside while-loop $disabled = ''; // default if ($partner == 'no') { // check double == here! $disabled = "disabled"; } ?> // add string-var html-element <input type="checkbox" name="checkpartner" <?php echo $disabled ?>/>
Comments
Post a Comment