Jump to content


Photo

Message Box / Prompt!!


  • Please log in to reply
6 replies to this topic

#1 marccesar

marccesar
  • New Members
  • Pip
  • Newbie
  • 3 posts
  • LocationThousand Oaks, CA

Posted 07 June 2006 - 10:51 PM

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

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 07 June 2006 - 10:53 PM

Thats because message boxes and the like are client-side, javascript, not php.

#3 xyph

xyph
  • Staff Alumni
  • Advanced Member
  • 3,712 posts
  • LocationSurrey, BC

Posted 07 June 2006 - 10:57 PM

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>
Everything you need to know about storing user-names and passwords
http://www.openwall....Users-Passwords
Blank Page? Try forcing errors to display
ini_set('display_errors',1);
error_reporting(-1);

#4 Woodburn2006

Woodburn2006
  • Members
  • PipPipPip
  • Advanced Member
  • 214 posts

Posted 13 June 2006 - 02:01 PM

[!--quoteo(post=381206:date=Jun 7 2006, 11:57 PM:name=xyph)--][div class=\'quotetop\']QUOTE(xyph @ Jun 7 2006, 11:57 PM) View Post[/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

#5 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 13 June 2006 - 02:02 PM

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

~ D Kuang

#6 Woodburn2006

Woodburn2006
  • Members
  • PipPipPip
  • Advanced Member
  • 214 posts

Posted 13 June 2006 - 02:04 PM

[!--quoteo(post=383271:date=Jun 13 2006, 03:02 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 13 2006, 03:02 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
echo "<a href='delete_supplier.php' onClick='return confirm(\"Are you sure that you want to delete this supplier?\");'>Delete You</a>"
[/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\" /]

#7 mark s

mark s
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 13 June 2006 - 02:07 PM

I use this

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";


Hope that helps :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users