bcamp1973 Posted March 21, 2007 Share Posted March 21, 2007 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 More sharing options...
bcamp1973 Posted March 21, 2007 Author Share Posted March 21, 2007 grr...ok, i solved it. the code above should actually work..i had a formatting issue with the query that i "fixed" when i simplified it for the example above. Link to comment https://forums.phpfreaks.com/topic/43709-deleting-items-from-a-list/#findComment-212195 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.