2013-10-26 63 views
-2

我想通過ID值到POPUP DIV並更新到狀態表,帶有ID的suggest_text區域。如何將數據傳遞給PHP中的PopUp Div?

如果我通過這樣的href="#pop1?id=<?php echo $row['id']; ?> POPUP div不是開放的。所以我不知道怎麼打發,所以有些人告訴我,我怎麼能在PHP或者在Javascript

由於通過提前

   <div class="widget-content"> 
        <table class="table table-bordered table-striped data-table"> 
        <thead> 
         <tr> 
          <th>S.No</th> 
          <th>Employee Name</th> 
          <th>Reason</th> 
          <th>Category</th> 
          <th>From</th> 
          <th>To</th> 
          <th>No Of Days</th> 
          <th>Action</th> 
         </tr> 
        </thead> 
        <tbody> 
         <?php 
         $result=mysql_query("select * from leave_request"); 
         while($row=mysql_fetch_array($result)) 

         {?> 
         <tr> 
          <td><?php echo $row['id'];?></td> 
          <td> <?php echo $row['emp_name'];?></td> 
          <td> <?php echo $row['reason'];?></td> 
          <td> <?php echo $row['category'];?></td> 
          <td><?php echo $row['from_date'];?></td> 
          <td><?php echo $row['to_date'];?></td> 
          <td><?php echo $row['no_of_days'];?></td> 
          <td> 
          <a href="leave_dashboard.php?id=<?php echo $row['id']; ?>&status='1'" style="text-decoration:none;">Accept </a> | 
          <a href="leave_dashboard.php?id=<?php echo $row['id']; ?>&status='2'"> Reject </a>| 
          <a href="#pop1?id=<?php echo $row['id']; ?>"> Suggest</a> </td> 
           <div id="pop1" class="pop-up"> 
           <?php $suggest_id = $_GET['id']; ?> 
           <div class="popBox"> 
            <div class="popScroll"> 
             <form> 
              <textarea name="suggest" id="suggest" cols="60" rows="8" ></textarea> 
              <input type="text" name="id" value="<?php echo $suggest_id; ?>"> 
              <input type="text" name="status" value="3"> 
              <button type="submit" name="submit" class="btn btn-primary">Submit</button> 
             </form> 
             <!-- popup content end here --> 
            </div> 
            <a href="#links" class="close"><span>Back to links</span></a> 
           </div> 
           <a href="#links" class="lightbox">Back to links</a> 
           </div> 
          </tr> 
         <?php }?> 
        </tbody> 
       </table>  
       </div> 
+0

檢查控制檯的錯誤,讓我知道控制檯中的錯誤。 –

+0

將ID值傳遞給POPUP DIV?或獲取ID? –

回答

0

當我看到您的彈出DIV是在WHILE循環,使你可以讓您的ID是這樣的: -

初始化值說K = 1;,並把這個值每彈出

<a href="#pop<?php echo $k; ?>"> Suggest</a>

全碼: -

<?php 
    $result=mysql_query("select * from leave_request"); 
    while($row=mysql_fetch_array($result))  
    { 
     $k =1; 

    ?> 
     <tr> 
     <td><?php echo $row['id'];?></td> 
     <td> <?php echo $row['emp_name'];?></td> 
     <td> <?php echo $row['reason'];?></td> 
     <td> <?php echo $row['category'];?></td> 
     <td><?php echo $row['from_date'];?></td> 
     <td><?php echo $row['to_date'];?></td> 
     <td><?php echo $row['no_of_days'];?></td> 
     <td> 
     <a href="leave_dashboard.php?id=<?php echo $row['id']; ?>&status='1'" style="text-decoration:none;">Accept </a> | 
     <a href="leave_dashboard.php?id=<?php echo $row['id']; ?>&status='2'"> Reject </a>| 
     <a href="#pop<?php echo $k; ?>"> Suggest</a> </td> 



     <div id="pop<?php echo $k; ?>" class="pop-up"> 

     <div class="popBox"> 
     <div class="popScroll"> 
     <form> 
      <textarea name="suggest" id="suggest" cols="60" rows="8" ></textarea> 
      <input type="text" name="id" value="<?php echo $row['id']"> 
      <input type="text" name="status" value="3"> 
      <button type="submit" name="submit" class="btn btn-primary">Submit</button> 
     </form> 
      <!-- popup content end here --> 
     </div> 
      <a href="#links" class="close"><span>Back to links</span></a> 
      </div> 
      <a href="#links" class="lightbox">Back to links</a> 
      </div> 
    </tr> 
    <?php 

     $k++; 

    }?>