how can I make users check on textclick? My script is: 开发者_JAVA技巧
 <?php 
      foreach($getcountry_name as $key => $value)
 { ?>
    <tr>
        <td width="25" valign="top">
        <input name="country_name[]"  
             type="checkbox" checked="checked" 
             value="<?php echo $value['country_id']; ?>" />
        </td>
        <td>
        <label class="type01"><?php echo $value['country_name']; ?></label>
        </td>
    </tr> 
   <?php
     }
   ?>        
thanks in advance
The <label> needs a for attribute that contains the ID of the <input> field it's linked to.
e.g.
<input id="myID" name="country_name[]"  type="checkbox" checked="checked" value="<?php echo $value['country_id']; ?>" />
<label for="myID" class="type01"><?php echo $value['country_name']; ?></label>
Edit:
Applying it to your example,
<?php 
      foreach($getcountry_name as $key => $value)
 { ?>
    <tr>
        <td width="25" valign="top">
        <input id="country_name_<?php echo $value['country_id']; ?>" name="country_name[]"  
             type="checkbox" checked="checked" 
             value="<?php echo $value['country_id']; ?>" />
        </td>
        <td>
        <label for="country_name_<?php echo $value['country_id']; ?>" class="type01"><?php echo $value['country_name']; ?></label>
        </td>
    </tr> 
   <?php
     }
   ?>  
Give the inputan ID and let your label use this as the value for a for attribute.
<tr>
    <td width="25" valign="top">
        <input id="<?php $id=uniqid('id_'); echo $id; ?>" name="country_name[]" type="checkbox" checked="checked" value="<?php echo $value['country_id']; ?>" />
    </td>
    <td>
        <label for="<?php echo $id; ?>" class="type01"><?php echo $value['country_name']; ?></label>
    </td>
</tr>
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论