ERROR deleting item from database using confirm box
<p>I have the following code which retrieves items from my DB and displays them in a table. The file is manage-products.php.</p>

<pre><code>while($row = mysql_fetch_row($result)){
       echo '&lt;/tr&gt;';
       echo ' &lt;td class="product"&gt;&lt;a href="manage-products-2.php"&gt;'.$row[1].'&lt;/a&gt;&lt;/td&gt;';
       echo'&lt;td class="quantity"&gt;'.$row[5].'&lt;/td&gt;';
       echo '&lt;td class="item_price"&gt;'.$row[4].'&lt;/td&gt;';
       echo '&lt;td class="item_total"&gt;'.$row[6].'&lt;/td&gt;';
       echo '&lt;td class="item_unsold"&gt;&lt;a href = "manage-products.php?prod = '.$row[0].'" style="color:red"&gt;Delete&lt;/a&gt;&lt;/td&gt;';//to delete an item
       echo '&lt;/tr&gt;';
}
</code></pre>

<p>I have the following code (which should be executed) when the DELETE link is clicked (also in manage-products.php)</p>

<pre><code>$prodid = $_GET['prod'];

if($prodid != ""){
  echo '&lt;script type="text/javascript"&gt; 
  var r = window.confirm("Are you sure you want to delete this product") ;
  if(r == true){
    $ . post ( "manage-products.php" ,  { result : r });
  }
  &lt;/script&gt;';
  $delete = $_POST['result'];
  if($delete == true){
    $SQL1 = "DELETE FROM tbl_product WHERE id = '$prodid'";
    $result1 = mysql_query($SQL1);
  }
}
</code></pre>

<p>When i click delete it says undefined index:prod. Please where is my error. Thanks</p>
