javascript - Loop PHP forms a chosen number of time from drop box -
<div id="form1" /> <form name="choice"> <table> <tr> <td> number of new types want add </td> <td> <select name="<?php echo $num; ?>"> <option value="1" selected>1 row</option> <option value="2">2 rows</option> <option value="3">3 rows</option> <option value="4">4 rows</option> <option value="5">5 rows</option> </select> <div class='inputs'></div> </td> </tr> </table> </form> <form name="myform" action="addaccessories.php" method="post" onsubmit="return validateform(this);"> <table border="1"> <tr> <th>barcode<em>*</em></th> <th>description<em>*</em></th> <th>minimum required stock<em>*</em></th> <th>current stock</th> </tr> <?php echo $num; ?> <tr> <td><input type="text" name="bar_code/></td> <div class="ui-widget"> <td><input name="description/></td> </div> <td><input type="text" name="minimum_required_stock" /></td> <td><input type="text" name="num_stock" value="0"></td> <tr> <td> </td> <td> <button data-theme="b" id="submit" type="submit">add accessories</button></td> </tr> </table> </form> hello guys, in code have 2 form, 1 drop box has 5 options , form text input. in theory, if choose option value="3", text form loop 3 times , 3 set of text inputs. however, haven't succeeded in doing far. , also, how can access these 3 sets of data in addaccessories.php file?
i appreciate opinion on topic. thank much.
reading question, sounds want have code such when selection in form choice changes, change number of rows in form myform. not possible php because runtime change on client machine. can write in javascript. need code called form choice adjusts dom in form myform.
Comments
Post a Comment