Jump to content

deleting items from a list


bcamp1973

Recommended Posts

When i click one of the delete buttons, the form submits, but nothing happens. I'm pretty sure i'm doing something stupid with the form buttons, but I've been staring at it too long...any takers?

 

The html...

<form id="listAll" action="?pg=addressbook&" method="post">
<ul>
<li><button type="submit" name="delete" value="3">DELETE</button><a href="?pg=addressbook&id=3">Last Name, First Name</a></li>
<li><button type="submit" name="delete" value="2">DELETE</button><a href="?pg=addressbook&id=2">Smith, John</a></li>
<li><button type="submit" name="delete" value="1">DELETE</button><a href="?pg=addressbook&id=1">Potter, Harry</a></li>
</ul>
</form>

 

The PHP...

if($_POST['delete']) {

mysql_query("DELETE FROM addresses WHERE id=".$_POST['delete']) or die(mysql_error());
}

Link to comment
https://forums.phpfreaks.com/topic/43709-deleting-items-from-a-list/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.