简单的形式;保存并继续以后的数据

时间:2015-11-24 09:12:42

标签: javascript php forms

我试图建立一个出勤表格,系统用户输入学生的数据然后如果出现紧急情况(或者他需要退出系统的原因)他只需要关闭浏览器并稍后继续使用表单上的数据。为了做到这一点,我使用了garlic.js(也在本网站上提出)。关于garlicjs.org的说明很简单,但我不能让我的表格工作。

我从数据库中检索数据并通过表格打印。这是我的代码

<form name="result"  data-persist="garlic" method="post" id="form"> 
Date: <input type="date" name="date" required="required" size="20" placeholder="Date"/><br>


   <?php
     if( $_POST["time_pm"] == ''){  ?>
        <table class="table table-striped">
           <thead>
             <tr>
               <th>ID #</th>
               <th>Name</th>
               <th>Time AM</th>
               <th>Time PM</th>
             </tr>
           </thead>
      <?php 
        if ($result->num_rows > 0) { // output data of each row
            while($row = mysql_fetch_assoc($getnames)) {
                 if($row['status']=='p'){                  
                  echo'<tbody>';
                   echo'<tr>';
                   echo '<td>' . $row['user_idnumber'] . '</td>';
                   echo '<td>' . $row['lastname'] . ', ' . $row['firstname'] . '</td>';
                   echo '<input type="hidden" name="selected[]" value="'.$row['user_idnumber'].'"/>';
                   echo '<td>' . ' <input type="time" name="time_am[]" required="required" placeholder="Score"/>' . '</td>';
                   echo '<td>' . ' <input type="time" name="time_pm[]" required="required" placeholder="Score"/>' . '</td>';
                 echo '</tr>';
             echo '</tbody>';
                            } //if statement
                          } //while statement
                     ?>
                  </table>
                    <input type="submit" name="submit" value="Submit" class="btn btn-info"/>
                  </form>

这只是一个简单的形式,但我无法在这里解决问题。日期输入工作正常,但在输入时间(AM和PM)时不起作用。如果我只为少数用户设置时间并让其他用户设置为空白(稍后继续),当我尝试点击刷新时,(用户)下面的其他所有人都会获得相同的时间。

0 个答案:

没有答案