php - How to populate a form with data selected from options on my mysql data -
i have form data selects data database. want each selected item have units echoed in corresponding unit input form. pls need simplified way of solving problem. here form:
<?php include ("header.php");?> <?php $start=1; $end= $_post['item']; for($start;$start<=$end;$start++){ require("connect.php"); $sql = "(select * drug_name)"; $result = mysqli_query($conn, $sql); ?> <form align="center" method="post" action="transactions.php" id='myform'> name: <select align="right" name="inputname[]" id='drug_item_name' value="drug_item_name"><option selected="selected" value="0">s/n select drug --</option> <?php while($row = $result->fetch_assoc()){ ?> <option ><?php echo$row['drug_item_name']?></option> <?php } ?> </select> <td align="right">unit:</td> <td><input type="text" name="input2[]" placeholder="enter unit" size="7" ></td> <td align="right">qty:</td> <td><input type="text" name="input3[]" placeholder="enter qty" size="5"></td> </tr> <?php echo '<br>'; ?> <?php } ?> <td><input type="submit" name=dispense" size="10" value="dispense"></td></table></form> </form>
Comments
Post a Comment