Jump to content

How to ingrate a jquery into a loop


yandoos
Go to solution Solved by requinix,

Recommended Posts

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 by yandoos
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.