2011-09-14 117 views
0

我有一個網站的用戶列表,主要是使用每個成員的唯一ID。用戶列表管理管理

我需要在每個名稱後面都有一個按鈕來刪除或修改,但我找不到如何正確執行此操作的代碼!

 $result = mysql_query("SELECT * FROM users ORDER BY ID_Usager"); 
     while($row = mysql_fetch_array($result)) 
      { 
      echo "<form method='post'>"; 
       echo "<tr>"; 
       echo "<td>" . $row['Pseudo'] . "</td>"; 
       echo "<td>" . $tempID . "</td>"; 
       echo "<td>" . $row['Email'] . "</td>"; 
       echo "<td>" . $row['Status'] . "<input type='submit' name='delete[" . $tempID . "]' value='Delete'> <input type='submit' name='modify[" . $tempID . "]' value='Modify'> </td>"; 
       echo "</tr>"; 
       echo "</form>"; 
      } 

(我跳過了一些表代碼..) 因此,這顯示爲:

文森特25625 [刪除] [修改]

那麼我想,當我點擊提交,它重新加載頁面,我看是否刪除後[]是空的,或修改爲空,...

 if(!empty($_POST['delete'])) 
     { 

      $test[] = $_GET['delete[]']; ---- LINE 163 ERROR... 

      //Delete from blablabla userID = $test; 
     } 
     else 
     { 
      ... check for modify then blablabla.  

     } 

但它不工作,我得到一個錯誤。

Notice: Undefined index: delete[] in C:\wamp\www\VMAD\admin_usagers.php on line 163 

回答

0

[]是問題所在。它應該是

$test = $_POST['delete']; 
+0

注意:未定義指數:刪除C:\ WAMP \ WWW \上線VMAD \ admin_usagers.php 163 同樣的錯誤:( – Insecurefarm

+0

啊,我沒有注意到你有表單集對於'POST'看到編輯 –

+0

我改變了它,$ test現在是ARRAY(在echo中),我怎樣才能達到ID號?謝謝! – Insecurefarm