bcamp1973 Posted March 26, 2007 Share Posted March 26, 2007 i have the following script at the top of the page and the form below on that same page. it works in Safari and FireFox on both PC and Mac. However, in IE the page just reloads and nothing gets deleted. Any suggestions? if($_POST['delete']) { $query='DELETE FROM addresses WHERE id='.$_POST['delete']; mysql_query($query) OR die(mysql_error()); } <form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post"> <ul> <li>Potter, Harry<input type="image" name="delete" value="2" src="assets/img/delete.gif" /></li> <li>Bar, Foo<input type="image" name="delete" value="8" src="assets/img/delete.gif" /></li> <li>Smith, John<input type="image" name="delete" value="9" src="assets/img/delete.gif" /></li> </ul> </form> Link to comment https://forums.phpfreaks.com/topic/44411-delete-buttons-on-form-not-working/ Share on other sites More sharing options...
per1os Posted March 26, 2007 Share Posted March 26, 2007 The name is conflict with each other. Use name="delete[]" instead and do this: if(isset($_POST['delete'])) { if (is_array($_POST['delete'])) { foreach ($_POST['delete'] as $val) { $query='DELETE FROM addresses WHERE id='.$val; mysql_query($query) OR die(mysql_error()); } } } Link to comment https://forums.phpfreaks.com/topic/44411-delete-buttons-on-form-not-working/#findComment-215660 Share on other sites More sharing options...
bcamp1973 Posted March 26, 2007 Author Share Posted March 26, 2007 ahh, ok...that works...thanks! Link to comment https://forums.phpfreaks.com/topic/44411-delete-buttons-on-form-not-working/#findComment-215687 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.