Jump to content

[SOLVED] won't delete


sandbudd

Recommended Posts

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

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

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.