用户将数据插入表单后,数据为空

时间:2018-09-19 09:11:31

标签: php mysql ajax

这是我在view-reservation.php中的HTML代码。 PHP代码位于data-reservation.php中。

echo '<div class="form-group">';
    echo '<div class="input-group">';
       echo '<form method="POST">';
           echo '<input type="text" id="search_data" class="form-control" placeholder="Search here..." style="width:300px;margin-bottom:10px"; />';
           echo '<button type="button" id="search" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span></button>';
           echo '<button type="button" id="refresh" class="btn btn-success"><span class="glyphicon glyphicon-refresh"></span></button>';
       echo '</form>';
    echo '</div>';
echo '</div>';
echo '<div class="table-responsive">';
   echo '<table class="table table-striped table-bordered">';
      echo '<thead>';
         echo '<tr>
           <th width="150px">Name</th>
           <th width="200px">Address</th>
           <th width="60px">Ic No.</th>
           <th width="60px">Phone No.</th>
           <th width="60px">Room</th>
           <th width="100px">Action</th>
         </tr>';
       echo '</thead>';
     echo '<tbody id="data"></tbody>';
   echo '</table>';
echo '</div>';

<?php
   require_once 'config/database.php';
   if(isset($_POST['res'])) {           
       $query = $con->query("SELECT * FROM `room` ORDER BY `id` ASC");           
          while($row = $query->fetch_array()) {
             echo '<tr>';
                echo '<td>' . $row['name'] . '</td>';
                echo '<td>' . $row['address'] . '</td>';
                echo '<td>' . $row['icNumber'] . '</td>';
                echo '<td>' . $row['phoneNumber'] . '</td>';
                echo '<td>';
                   echo '<a href="read_reservation.php?id=' . $row['id'] . '" class="btn btn-info m-r-1em"> <span class="glyphicon glyphicon-list"></span> Detail </a>';
                echo '</td>';
                echo '<td>';
                    echo '<a href="update_reservation.php?id=' . $row['id'] . '" class="btn btn-primary m-r-1em"> <span class="glyphicon glyphicon-edit" title="Edit"></span> </a>';
                    echo '<a href="receipt.php?id=' . $row['id'] . '" class="btn btn-primary m-r-1em"> <span class="glyphicon glyphicon-print" title="Print"></span> </a>';
                    echo '<a href="#" onclick="delete_room(' .$row['id']. ')"  class="btn btn-danger"> <span class="glyphicon glyphicon-trash" title="Delete"></span> </a>';
                echo'</td>';
              echo '</tr>';
          }       
    }
?>

**在此之前,但是在我在view-reservation.php中添加搜索功能之后。数据将不会显示。

0 个答案:

没有答案