<form action="checkbox.php" method="post"> <div class="checkbox"> <label><input type="checkbox" name="size[]" value="s">S</label> </div> <div class="checkbox"> <label><input type="checkbox" name="size[]" value="m">M</label> </div> <div class="checkbox"> <label><input type="checkbox" name="size[]" value="l">L</label> </div> <div class="checkbox"> <label><input type="checkbox" name="size[]" value="xl">Xl</label> </div> </form>
here is my html code i want to selelct more then one checkbox, and it will fetch data from databse respectively from the selelct checkbox.
please tell me what to do?
here i dont want to use <form> tag.

Recommended Answers

All 2 Replies

$("[checkbox]").each(){
    $(this) 
    //this is your checkbos 
    you can elaborate val and attributes 
    send to the server via $.post(...)
}
<?php
$selectedSizes = ( isset($_POST[size]) ? implode(",", $_POST[size]) : "" );
$sql = "SELECT * FROM `your_table_name` t WHERE FIND_IN_SET(t.`size_field`, ?)";
// then bind param $selectedSizes and execute query
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.