php - How can I add checkbox in the drop down? -
i trying add check box in drop down, don't know how achieve this. below code used define check-boxes:
<html> <head> <title>scrolling checkboxes</title> <script type="text/javascript"> </script> </head> <body> <div id="scrollcb" style="height:150;width:200px;overflow:auto"> <input type="checkbox" id="scb1" name="scb1" value="1">0-1 hours<br> <input type="checkbox" id="scb2" name="scb2" value="2">1-2 hours<br> <input type="checkbox" id="scb3" name="scb3" value="3">2-3 hours<br> <input type="checkbox" id="scb4" name="scb4" value="4">3-4 hours<br> <input type="checkbox" id="scb5" name="scb5" value="5">4-5 hours<br> <input type="checkbox" id="scb6" name="scb6" value="6">5-6 hours<br> <input type="checkbox" id="scb7" name="scb7" value="7">6-7 hours<br> <input type="checkbox" id="scb8" name="scb8" value="8">7-8 hours<br> <input type="checkbox" id="scb9" name="scb9" value="9">8-9 hours<br> </div> </body> </html>
below code define drop-down-:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> </head> <body> <?php function select_time($time_) { ?> <select id="ftime" name="selecteddate_t<?php echo $time_ ;?>"> <?php for($t=0;$t<=23;$t++) { ?> <option value=" <?php echo $t; ?>"><?php echo $t; ?></option> <?php } ?> </select> <?php } ?> <form action="xyz.php" method="post"> <?php echo "time: "select_time('from');?> </form> </body> </html>
i want when 1 click on drop-down, list of check-boxes display , he/she may able select more 1 check box. also, please explain how can selected value in variable. trying provide user option select multiple time slots , per selection show him/her required stats. have no idea need quiet feasible or not. had tried lot integrate check boxes drop-down, did not reached desired result.
below code works me please have on this. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jquery dropdown check list</title> <link rel="stylesheet" type="text/css" href="ui.dropdownchecklist.css" /> <link rel="stylesheet" type="text/css" href="demo.css" /> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="ui.core.js"></script> <script type="text/javascript" src="ui.dropdownchecklist.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#s4").dropdownchecklist({ maxdropheight: 120 }); }); </script> </head> <body> <?php echo "<br>"; function submit_button() { ?> <input name="submit" type="submit"> <?php } ?> <?php function multiple_chk($selectedbox) { ?> <select id="selectedbox" name="selectedbox<?php echo $year; ?>"> <?php for($k=1;$k<=3;$k++) {?> <option value="<?php echo '201'.$k; ?> "><?php echo '201'.$k; ?></option> <?php } ?> </select> <?php } ?> <div id="content"> <p> <select id="s4" name="multiple[]" multiple="multiple" size="4" > <option name="assa">0-1 hours</option> <option value="dssd">1-2 hours</option> <option value="2">2-3 hours</option> <option>3-4 hours</option> <option>4-5 hours</option> <option>5-6 hours</option> <option>6-7 hours</option> <option>7-8 hours</option> <option>8-9 hours</option> <option>9-10 hours</option> <option>10-11 hours</option> <option>11-12 hours</option> <option>12-13 hours</option> <option>13-14 hours</option> <option>14-15 hours</option> <option>15-16 hours</option> <option>16-17 hours</option> <option>17-18 hours</option> <option>18-19 hours</option> <option>19-20 hours</option> <option>20-21 hours</option> <option>21-22 hours</option> <option>22-23 hours</option> <option>23-24 hours</option> </select> <?php submit_button(); ?></form> </p> <?php echo '<pre>';print_r($_request);echo '</pre>'; ?> </div> </body> </html>
Comments
Post a Comment