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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -