Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP won't delete from MySQL
    text
    copied!<p>The PHP code won't delete item from database using "$noteid". If I put a number in it's place it will, but when I try using "$noteid". It won't do it. It does everything correct up to the point where it tries to delete.</p> <p>Here's how I get the "$noteid":</p> <pre><code>//javascript function viewnote(noteid) { window.location = "noteview.php?noteid=" + noteid; } //button in body &lt;input type="button" value="Edit" onclick="editnote('&lt;?= $noteid ?&gt;')" /&gt; </code></pre> <p>Here's the code on the linked to page:</p> <pre><code>&lt;?php $noteid = $_REQUEST['noteid']; if (isset($_POST['delete'])){ mysql_query("DELETE FROM notes WHERE noteid='$noteid'"); header ('Location: index2.php'); } ?&gt; &lt;body&gt; &lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" style="margin:0px; pading:0px"&gt;&lt;input type="submit" name="delete" value="Delete"&gt;&lt;/form&gt; &lt;/body&gt; </code></pre> <hr> <p>** It's Working Now!!! ** What made it work was a hidden form field.</p> <p>Here's the code:</p> <pre><code>&lt;?php if (isset($_POST['delete'])){ $nid = $_REQUEST['notenum']; mysql_query("DELETE FROM notes WHERE noteid='$nid'"); header ('Location: index2.php'); } ?&gt; //body cody &lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" style="margin:0px; pading:0px"&gt;&lt;input type="text" name="notenum" value="&lt;?php echo $noteid; ?&gt;" style="display:none" /&gt;&lt;input type="submit" name="delete" value="Delete"&gt;&lt;/form&gt; </code></pre> <p>Thanks to everyone for your help!!! This site is my favourite site now.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload