0

hi all,
i am having a user table in which userid and username are present. i had a delete button also. so wen i click on the delete button that person details only should get delete. so all i had done. I can delete the information using 'userid'. how can i pass that userid value to the next page.
Thank u.

Edited by niths: n/a

4
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

You can give userid on delete button's href.
e.g. <a href="user.php?act=delete&userid=<?=$result?>">delete</a>

0

You can give userid on delete button's href.
e.g. <a href="user.php?act=delete&userid=<?=$result?>">delete</a>

that is link na i kept button for deleting.

0

same way buttons onclick event using js.
<input name="Delete" value="Delete" type="button" onclick="window.location.href='user.php?act=delete&userid=<?=$result?>'" />

0

Can I suggest that you include a confirmation paramater that contains a hash so that only official deletes can occur. In addition, how about a javascript confirm popup that sits between the link and the page with the delete script?

<a href="deleteuser.php?id=3&conf=hsyY62j98HH....">Delete user</a>

The conf parameter is built thus:

$user = 3; //but you usually get this from the DB
$username = "Alan Davies"; //you also get this from the DB
$conf = md5("mysalt" . $user . "another salt");

$link = "<a href=\"deleteuser.php?id=$user&amp;conf=$conf\">Delete $username</a>";

Your deleteuser.php then searches and deciphers the conf:

if(isset($_GET['id']) && isset($_GET['conf']) && $_GET['conf'] == md5("mysalt" . $_GET['id'] . "another salt")){
   //success!
}else{
  //fail
}

I haven't included the confirm popup code, but that's easy with onclick.

0

You designed the page with form r8!

<form name='frmdetails'  action='delete.php' method='post'>
 ........ 
<input type='submit' value='delete' name='deluser'/>
</form>

I hope you are going to pass the value to the next page(delete.php)

Just get the value from there with post

$uid = $_POST['userid'];
echo $uid
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.