sandbudd Posted August 7, 2009 Share Posted August 7, 2009 Hey guys I do not know why this isn't working I am to close to the problem to see it. I'm sure it is a simple fix. I states that it has been deleted but remains in the database. Here are the two files, the first displays which works fine but when clicked the delete it does not delete? <?php include "../connect.php"; $getlist="SELECT * from members order by member ASC"; //select e-mails in ABC order $getlist2=mysql_query($getlist) or die("Could not get list"); while($getlist3=mysql_fetch_array($getlist2)) { print "<tr><td>$getlist3[member]<br><A href='mailto:$getlist3[email]'>$getlist3[email]</a><br><A href='deluser.php?userID=$getlist3[userID]'>Delete</a></td></tr>"; } print "</table>"; ?> <?php include "../connect.php"; if(isset($_POST['submit'])) { $ID=$_POST['userID']; $ID=trim($ID); $ID=strip_tags($ID); $deluser="Delete from members where userID='$ID'"; mysql_query($deluser) or die("Could not delete user"); print "deleted."; } else { $ID=$_GET['ID']; $ID=trim($ID); $ID=strip_tags($ID); print "<form action='deluser.php' method='post'>"; print "<input type='hidden' name='ID' value='$ID'>"; print "Are you sure you want to delete this user?"; print "<input type='submit' name='submit' value='submit'></form>"; } ?> Link to comment https://forums.phpfreaks.com/topic/169291-solved-wont-delete/ Share on other sites More sharing options...
Mardoxx Posted August 7, 2009 Share Posted August 7, 2009 $deluser="Delete from members where userID='$ID'"; try: $deluser="Delete from members where userID=$ID"; Link to comment https://forums.phpfreaks.com/topic/169291-solved-wont-delete/#findComment-893344 Share on other sites More sharing options...
gevans Posted August 7, 2009 Share Posted August 7, 2009 $ID=$_POST['userID']; should be $ID=$_POST['ID']; and $ID=$_GET['ID']; should be $ID=$_GET['userID']; So you're not actually getting the id. Link to comment https://forums.phpfreaks.com/topic/169291-solved-wont-delete/#findComment-893346 Share on other sites More sharing options...
Mardoxx Posted August 7, 2009 Share Posted August 7, 2009 //edit disragard that i suck cocks.. yeah $ID=$_GET['ID']; should be $ID=$_GET['userID']; Link to comment https://forums.phpfreaks.com/topic/169291-solved-wont-delete/#findComment-893348 Share on other sites More sharing options...
gevans Posted August 7, 2009 Share Posted August 7, 2009 he's got <A href='deluser.php?userID= so then if he posts that $ID=$_POST['userID']; won't that be correct ^ ^ ^ ^ No becuase that is sending the userID as a GET request. The only post data comes from the form where the input is named "ID" not "userID" Link to comment https://forums.phpfreaks.com/topic/169291-solved-wont-delete/#findComment-893351 Share on other sites More sharing options...
Mardoxx Posted August 7, 2009 Share Posted August 7, 2009 F5 Link to comment https://forums.phpfreaks.com/topic/169291-solved-wont-delete/#findComment-893353 Share on other sites More sharing options...
sandbudd Posted August 8, 2009 Author Share Posted August 8, 2009 that did it told you I was to close thanks gevans Link to comment https://forums.phpfreaks.com/topic/169291-solved-wont-delete/#findComment-893354 Share on other sites More sharing options...
gevans Posted August 8, 2009 Share Posted August 8, 2009 No worries, hit solved Link to comment https://forums.phpfreaks.com/topic/169291-solved-wont-delete/#findComment-893355 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.