Jump to content

Archived

This topic is now archived and is closed to further replies.

marccesar

Message Box / Prompt!!

Recommended Posts

im having trouble finding a function that will let me do the following:

when user clicks a certain href it will delete a row from my database (by submitting the form to another php page which carries this out)... before it does that i would like it to prompt the user asking 'are you sure you want to delete so and so?' with a YES and CANCEL button. if yes - it goes to the delete page, if cancel, it stays put.

how do i do this?? i haven't been able to find anything about this!

thanks in advance!

marc

Share this post


Link to post
Share on other sites
Thats because message boxes and the like are client-side, javascript, not php.

Share this post


Link to post
Share on other sites
Just put this in your delete link

<a href="delete.php" onclick="javascript:return confirm('Are you sure you want to delete this entry?\n(It cannot be undone)')">LINK</a>

Share this post


Link to post
Share on other sites
[!--quoteo(post=381206:date=Jun 7 2006, 11:57 PM:name=xyph)--][div class=\'quotetop\']QUOTE(xyph @ Jun 7 2006, 11:57 PM) [snapback]381206[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Just put this in your delete link

<a href="delete.php" onclick="javascript:return confirm('Are you sure you want to delete this entry?\n(It cannot be undone)')">LINK</a>
[/quote]

i am also trying to do this, but if you put it inside a PHP echo statement it does not work, any ideas?

i tried this:

<?
echo "<a href='delete_supplier.php' onClick='return confirm('Are you sure that you want to delete this supplier?');'>Delete You</a>"
?>

it will still continue to the delete page but will not display the message box

Share this post


Link to post
Share on other sites
[code]echo "<a href='delete_supplier.php' onClick='return confirm(\"Are you sure that you want to delete this supplier?\");'>Delete You</a>"[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=383271:date=Jun 13 2006, 03:02 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 13 2006, 03:02 PM) [snapback]383271[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]echo "<a href='delete_supplier.php' onClick='return confirm(\"Are you sure that you want to delete this supplier?\");'>Delete You</a>"[/code]
[/quote]

thanks very much, works fine [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]

Share this post


Link to post
Share on other sites
I use this

[code]echo "<TD WIDTH=\"60\" ALIGN=\"CENTER\">
            <A HREF=\"$PHP_SELF?action=is_spam\"
               onClick=\"return confirm('Will be Changed to SPAM');\">
            Change</A>
            </TD>\n";[/code]

Hope that helps :)

Share this post


Link to post
Share on other sites

×

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.