提交表单时while循环不起作用

时间:2017-11-08 05:56:28

标签: javascript php forms while-loop

  <form action="attempt.php" method="POST">
   <table class="table table-bordered table-hover datatable">
      thead>
      <th class="sorting" style="display:;" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Company_Name: activate to sort column ascending" style="width: 117px;">Id</th>
      th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Company_Name: activate to sort column ascending" style="width: 117px;">Company_Name</th>
      <th class="sorting_desc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="descending" aria-label="Street: activate to sort column ascending" style="width: 93px;">Street</th>
      <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Suburb: activate to sort column ascending" style="width: 120px;">Suburb</th>
      <th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" aria-label="State" style="width: 37px;">State</th>
      <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Dial_Number: activate to sort column ascending" style="width: 92px;">Dial_Number</th>
      <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Expiry_Date: activate to sort column ascending" style="width: 85px;">Expiry_Date</th>
      <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Call: activate to sort column ascending" style="width: 57px;">Dispositions</th>
      <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Call: activate to sort column ascending" style="width: 185px;">Feedback</th>
      <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Call: activate to sort column ascending" style="width: 65px;">Action</th>
      </tr>
      </thead>
      <tbody>
         <?php
            $username=$_SESSION['username'];

            $sql2 = "SELECT * FROM dial_normal WHERE `Agent`='$username'  AND `Assign_Status`=1 AND `Dial_Status`=0";

            $resultset2 = mysqli_query($db,$sql2) ;

             if(mysqli_num_rows($resultset2)) { 
            while( $rows = mysqli_fetch_assoc($resultset2) ) { 
            ?>
         <tr>
            <td style="display:;"><input type='text' style="border: 0; background-color: #fff; width:40px" name='row' value='<?php echo $rows['id'] ?> ' readonly=readonly /></td>
            <td><?php echo $rows['Company_Name']; ?></td>
            <td><?php echo $rows['Street']; ?></td>
            <td><?php echo $rows['Suburb']; ?></td>
            <td><?php echo $rows['State']; ?></td>
            <td><?php echo $rows['Dial_Number']; ?></td>
            <td><?php echo $rows['Expiry_Date']; ?></td>
            <td>
               <select name='dis'>
                  <option value='Appointment'>Appointment Made</option>
                  <option value='DNC'>Do Not Call</option>
                  <option value='CB'>Call Back</option>
                  <option value='NE'>Not Eligible</option>
                  <option value='HO'>Head Office</option>
                  <option value='NI'>Not Interested</option>
                  <option value='NV'>Not available</option>
                  <option value='AM'>Answering Machine</option>
                  <option value='HU'>Hung Up</option>
                  <option value='BN'>Bad/Wrong Number</option>
                  <option value='NA'>No Answer</option>
               </select>
            </td>
            <td><input type='text' name='feedback'/> </td>
            <td><input type='submit' name='submit' value='submit'/> </td>
         </tr>
         <?php } } 
            else   {
             ?>   
         <tr>
            <td colspan="5">No records to display.....</td>
         </tr>
         <?php } ?>     
      </tbody>
   </table>
</form>

1 个答案:

答案 0 :(得分:-1)

 this is the submit form from external attempt1.php 
 <?php 
 Session_start();
include_once("db_connect.php");
$row=$_POST['row'];
 $dis=$_POST['dis'];
$feedback=$_POST['feedback'];
$date= date("Y-m-d") ;

$ sql =“UPDATE dial_normal SET

Attempt1 = '$ DIS',Dial_Status = 1,Feedback1 = '$反馈',Attempt1_Date = '$日期',Last_Dialed_Date = '$ date',Final ='$ dis'WHERE id ='$ row'“; echo $ sql;  ?&GT; 问题是 当我尝试将第1条记录提交到第10条记录时。