dora1989 2017-01-20 22:29
浏览 135

如何从bootstrap datepicker获取值并将其传递给比较数据存储数据库

I want to get value from datepicker (only on change without using any button), and compare this date with stored database. My project is for orders and every order has a date, so I want to view old or new orders depending on their dates. Also when opening the website, it should display the current date (today) with its orders. Here's my code:

<input class="datepicker" name="datepicker"  id="datepicker" />

<script> //date picker js

$(function() {               
  $("#datepicker" ).datepicker({

    dateFormat : 'dd-mm-yy',


$q_customer = $conn->query("SELECT * from orders inner JOIN 
        customer_order on customer_order.order_no 
        =orders.order_no inner join driver_order  on 
        driver_order.order_no=orders.order_no LEFT JOIN 
        customer on 
        order by k_time" ) or die(mysqli_error());

$k_time = '';

while($f_customer = $q_customer->fetch_array()){?>


if($k_time == '' || $k_time != $f_customer['k_time']){
  $k_time = $f_customer['k_time'];

  echo "<td>".$f_customer['k_time']."</td>";

} else{
  echo "<td>&nbsp;</td>";

<td><?php echo $f_customer['order_no']?></td>
<td><?php echo $f_customer['first_name']?></td>
<td><?php echo $f_customer['last_name']?></td>
<td><?php echo $f_customer['address']?></td>
<td><?php echo $f_customer['driver_no']?></td>
<td><?php echo $f_customer['d_time']?></td>
<td><?php echo $f_customer['no_ofppl']?></td>
  • 写回答

1条回答 默认 最新

  • doutang1946 2017-01-21 06:53


    You can also set this as a variable or if you want to get the date by selecting the day then try this.

    $('#datepicker').on('changeDate', function(e) {
      var date =;

    Althought you need to change the format of the date.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 对于这个问题的算法代码
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据