yandoos Posted July 22, 2015 Share Posted July 22, 2015 (edited) Hello I'm using a nice datepicker that I want to use on text fields pulled form the database. The things is at the moment only the first row of results (which consists of 3 datepicker fields) actually work with it. I really need to know how to integrate it within the while loop so each row uses the datepicker functionality. Any chance you can help me please? <head> <title>Admin Area - Distributions</title> <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> <link href="css/style.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <script> $(function() { $( "#datepicker" ).datepicker(); }); $(function() { $( "#datepicker1" ).datepicker(); }); $(function() { $( "#datepicker2" ).datepicker(); }); </script> </head> $data = mysqli_query($connection," SELECT name, productname, pdid, description, image1, image2, image3, price, status, delivery_date, start, end, ref, balance FROM distribution join product ON distribution.pid = product.pid join plus_signup ON distribution.mem_id = plus_signup.mem_id") or die (mysql_error()); while($build = mysqli_fetch_array($data)) { ?> <table><tr><td><form action="update_distributions.php" enctype="multipart/form-data" method="post"> <input name="pdid" type="hidden" value="<?php echo $build['pdid'];?>" /> Status: </td><td><select name="status"> <option selected="selected"><?php echo $build['status']; ?></option> <option value="Accepted">Accepted</option> <option value="Complete">Complete</option> <option value="Damaged">Damaged</option> <option value="Delivered">Delivered</option> <option value="Offered">Offered</option> <option value="Sold">Sold</option> </select></td></tr> <tr><td>Balance:</td> <td><input name="balance" type="text" value="<?php echo $build['balance'];?>" /></td></tr> <tr><td>Delivery Date:</td> <td><input name="delivery_date" type="text" value="<?php echo $build['delivery_date'];?>" id = "datepicker2" /></td></tr> <tr><td>Start Date:</td> <td><input name="start" type="text" value="<?php echo $build['start'];?>" id = "datepicker" /></td></tr> <tr><td>End Date:</td> <td> <input name="end" type="text" value="<?php echo $build['end'];?>" id = "datepicker1" /></td></tr> <tr><td colspan="2" align="right"><Input type = "Submit" Name = "Submit1" id="mysubmit" VALUE = "Submit" ></td></tr></table> </form> <?php } ?> Thank you Edited July 22, 2015 by yandoos Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted July 22, 2015 Solution Share Posted July 22, 2015 IDs are unique. You cannot label more than one thing on a page with the same ID. Use classes instead. A class, in this case. Quote Link to comment Share on other sites More sharing options...
yandoos Posted July 23, 2015 Author Share Posted July 23, 2015 Brilliant, thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.