vendredi 24 juin 2016

Check multiple checkboxes for button(a tag) click

I just have these links (<a>):

<a href="" class="pool" > MEG </a>
<a href="" class="pool" > MEI </a>
<a href="" class="pool" > MVG </a>
<a href="" class="pool" > TAG </a>
<a href="" class="pool" > TAI </a>
<a href="" class="pool" > TVG </a>
<a href="" class="pool" > TVI </a>

And I made checkboxes from MySQL database table with this code(in php):

function getPackages3(){
    $con = openLockMySQLidb('labcom', 'packages', 'READ');
    $q = mysqli_query($con,"SELECT id, package FROM packages ORDER BY package ASC" );

    $packages = '<ul>';
    while ($row = mysqli_fetch_array($q)) {
        $packages .= '<li>'.'<label >'.'<input type="checkbox" class="packages_2" id="tab_packages" name="'.$row['package'].'" value="'.$row['id'].'-'.$row['package'].'">'.'<p class="checkbox_name">'.$row['package'].'</p>'.'</label></li>';
     }
     $packages .= '</ul>';

     closeUnlockMySQLidb($con);

     return $packages;
}

And i want to check multiple checkboxes(with jquery) if I click on "button". For example if i click on "MEG" "button" then check the checkboxes which value contains the "MEG" text.




Aucun commentaire:

Enregistrer un commentaire