0
echo "<td><a 
        href='delete.php?user_id=".$row['user_id']"' 
        onclick='return confirm("Do you want to delete?")'
        >DELETE</a></td>";

I am not being able to correct it...

Edited by manishrestha529

4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by diafol
0
echo "<td><a href='delete.php?user_id={$row['user_id']}' onclick='return confirm(\"Do you want to delete?\")'>DELETE</a></td>";
0

try something like this..

echo "<td><a href=delete.php?user_id=$row[user_id] onclick=return confirm('Do you want to delete?')> DELETE</a></td>";

not hundred percent sure..i just get it on top of my head..nothing wrong with trying:D

0
$therow = $row['user_id'];

echo '<td><a
    href="delete.php?user_id='.$therow.'" 
    onclick="return confirm("Do you want to delete?")">DELETE</a></td>';
0

I don't think any of these solutions will work for you. This might.

echo "<a href=\"#\" onclick=\"if(confirm('Do you want to delete?'))window.location='delete.php?user_id={$row['user_id']}';\">DELETE</a>

However, you should ensure that you have sufficient protection in delete.php so that ONLY you or a trusted user with sufficient rights can delete users (I assume from the DB).

I usually provide a 'defence in depth' measure of assigning a confirmation hash to go along with the id no, which is checked in delete.php.

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.