久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='r4gX5'><style id='r4gX5'><dir id='r4gX5'><q id='r4gX5'></q></dir></style></legend>
  • <tfoot id='r4gX5'></tfoot>

    <i id='r4gX5'><tr id='r4gX5'><dt id='r4gX5'><q id='r4gX5'><span id='r4gX5'><b id='r4gX5'><form id='r4gX5'><ins id='r4gX5'></ins><ul id='r4gX5'></ul><sub id='r4gX5'></sub></form><legend id='r4gX5'></legend><bdo id='r4gX5'><pre id='r4gX5'><center id='r4gX5'></center></pre></bdo></b><th id='r4gX5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='r4gX5'><tfoot id='r4gX5'></tfoot><dl id='r4gX5'><fieldset id='r4gX5'></fieldset></dl></div>
      <bdo id='r4gX5'></bdo><ul id='r4gX5'></ul>

        <small id='r4gX5'></small><noframes id='r4gX5'>

      1. 將刪除按鈕添加到 PHP 結果表

        Add Delete Button to PHP results table(將刪除按鈕添加到 PHP 結果表)

          <small id='6Fl6x'></small><noframes id='6Fl6x'>

            <tbody id='6Fl6x'></tbody>
            <legend id='6Fl6x'><style id='6Fl6x'><dir id='6Fl6x'><q id='6Fl6x'></q></dir></style></legend>
          1. <tfoot id='6Fl6x'></tfoot>
              <bdo id='6Fl6x'></bdo><ul id='6Fl6x'></ul>
              • <i id='6Fl6x'><tr id='6Fl6x'><dt id='6Fl6x'><q id='6Fl6x'><span id='6Fl6x'><b id='6Fl6x'><form id='6Fl6x'><ins id='6Fl6x'></ins><ul id='6Fl6x'></ul><sub id='6Fl6x'></sub></form><legend id='6Fl6x'></legend><bdo id='6Fl6x'><pre id='6Fl6x'><center id='6Fl6x'></center></pre></bdo></b><th id='6Fl6x'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6Fl6x'><tfoot id='6Fl6x'></tfoot><dl id='6Fl6x'><fieldset id='6Fl6x'></fieldset></dl></div>

                • 本文介紹了將刪除按鈕添加到 PHP 結果表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我已將 MySQL 表的結果輸出到 HTML 表.在最后一列中,我想添加一個刪除選項,它調用另一個表單并刪除用戶.我似乎無法讓它工作.

                  I have outputted the results of a MySQL table to an HTML table. In the last column, I want to add a delete option which calls another form and deletes the user. I can't seem to get it to work though.

                  這是我的結果頁面代碼:

                  This is my code for the results page:

                  <?php
                  
                      $contacts = mysql_query("
                          SELECT * FROM contacts ORDER BY ID ASC") or die( mysql_error() );
                  
                      // If results
                      if( mysql_num_rows( $contacts ) > 0 )
                      ?>
                  
                      <table id="contact-list">
                          <thead>
                              <tr>
                                  <th>Name</th>
                                  <th>Email</th>
                                  <th>Telephone</th>
                                  <th>Address</th>
                    <th>Delete</th>
                              </tr>
                          </thead>
                          <tbody>
                  
                          <?php while( $contact = mysql_fetch_array( $contacts ) ) : ?>
                  
                  
                  
                              <tr>
                                  <td class="contact-name"><?php echo $contact['name']; ?></td>
                                  <td class="contact-email"><?php echo $contact['email']; ?></td>
                                  <td class="contact-telephone"><?php echo $contact['telephone']; ?></td>
                                  <td class="contact-address"><?php echo $contact['address']; ?></td>
                                  <td class="contact-delete"><form action='delete.php' method="post">
                  <input type="hidden" name="name" value="">
                  <input type="submit" name="submit" value="Delete">
                  </form></td>                
                              </tr>
                  
                          <?php endwhile; ?>
                  
                          </tbody>
                      </table>
                  

                  而且,這是我的 delete.php 腳本

                  and, this is my delete.php script

                  <?php
                  
                  //Define the query
                  $query = "DELETE FROM contacts WHERE name={$_POST['name']} LIMIT 1";
                  
                  //sends the query to delete the entry
                  mysql_query ($query);
                  
                  if (mysql_affected_rows() == 1) { 
                  //if it updated
                  ?>
                  
                              <strong>Contact Has Been Deleted</strong><br /><br />
                  
                  <?php
                   } else { 
                  //if it failed
                  ?>
                  
                              <strong>Deletion Failed</strong><br /><br />
                  
                  
                  <?php
                  } 
                  ?>
                  

                  很確定我只是遺漏了一些東西,但我不知道那是什么:(

                  Pretty sure I'm just missing something, but I can't figure out what that is :(

                  推薦答案

                  您必須在刪除鏈接中傳遞變量.你必須通過 <?php echo $contact['name'];?> 隱藏字段中的名稱值或在 URL

                  You have to pass variable in delete link. You must have to pass <?php echo $contact['name']; ?> name value in hidden field or pass this value in URL

                  替換

                  <td class="contact-delete">
                        <form action='delete.php' method="post">
                        <input type="hidden" name="name" value="">
                        <input type="submit" name="submit" value="Delete">
                        </form>
                  </td>
                  

                  隨著

                  <td class="contact-delete">
                      <form action='delete.php?name="<?php echo $contact['name']; ?>"' method="post">
                          <input type="hidden" name="name" value="<?php echo $contact['name']; ?>">
                          <input type="submit" name="submit" value="Delete">
                      </form>
                  </td>
                  

                  這篇關于將刪除按鈕添加到 PHP 結果表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                  <i id='qP718'><tr id='qP718'><dt id='qP718'><q id='qP718'><span id='qP718'><b id='qP718'><form id='qP718'><ins id='qP718'></ins><ul id='qP718'></ul><sub id='qP718'></sub></form><legend id='qP718'></legend><bdo id='qP718'><pre id='qP718'><center id='qP718'></center></pre></bdo></b><th id='qP718'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='qP718'><tfoot id='qP718'></tfoot><dl id='qP718'><fieldset id='qP718'></fieldset></dl></div>
                  • <tfoot id='qP718'></tfoot>

                  • <small id='qP718'></small><noframes id='qP718'>

                  • <legend id='qP718'><style id='qP718'><dir id='qP718'><q id='qP718'></q></dir></style></legend>
                        <tbody id='qP718'></tbody>

                          • <bdo id='qP718'></bdo><ul id='qP718'></ul>
                            主站蜘蛛池模板: 91成年人| 久久久久久综合 | 天天天天天操 | 美女天天干 | 亚洲欧美中文字幕 | 亚洲黄色片 | 亚洲经典一区二区 | 国产黄色一级毛片 | 看真人一级毛片 | 国产三级免费观看 | 99视频在线 | 久久狠| 久久国产精品免费视频 | 亚洲伦理视频 | 一区二区三区四区av | 狠狠操狠狠操 | 91一级片 | 亚洲欧美日韩另类 | 婷婷久久久 | 国产精品一区av | 自拍偷拍av | 国产欧美精品一区 | 看黄色大片 | 日本成人一区二区 | 黄色裸体视频 | 午夜在线观看视频网站 | 国产精品久久久久久中文字 | 日本中文字幕在线播放 | 久久人体 | av影院在线 | 亚洲伊人色 | www.国产.com| 国产成人三级一区二区在线观看一 | 在线免费看a | av在线天堂 | 日本少妇做爰全过程毛片 | 91av视频 | 国产欧美日韩在线观看 | 91福利网站 | 国产www视频| 午夜网站在线观看 |