1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Rep Power
    Can any body help me with setting up a confirm box. I want a box that pops up when the user clicks on DELETE. The box will ask them if they are sure if they want to delete this person (yes or no). If they click no, then nothing will happen. If they click yes, then the will be sent to my delete script, along with the persons name (in the form of "delete.php3?fname=Jack&sname=Smith") Can this be done?? I know it can in Javascript but I have had no luck in getting the two to work. Can someone help me... I will try to make this my last query for a while
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Perth West Australia
    Rep Power
    If you do not want to use Javascript you can give the user an option to cancel on the page that deletes the file ie:

    on your delete page

    <?php if(!$Delete){?><!-- //If the first time in page!// -->

    Do you really want to Delete <?php echo "$fname $sname";?><br><!-- //echoed from calling page//
    <form name="one" method="post" action="<?php echo $PHP_SELF;?>"><!-- //$PHP_SELF returns the form back to itself//
    <input name="Delete" type="submit" value="delete"><!-- //naming the submit buttons id V important//

    <form name="two" method="post" action="path_back_to_calling page.php3">
    <input name="Candel" type="submit" value="Cancel">
    <?php } else { ?><!-- //IF Delete has been pressed//. -->

    //your code to delete the user here - will not be carried out unless the user clicks delete//

    <?php } ?><!-- //end of if!$delete// -->

    It is not pretty but it works - you can format it to look good - if you are comfortable with layers etc you can create a layer for the first part (!$Delete) to mimic an input box, you do not even have to hide the layer afterwards as PHP takes care of that.

    Hope it helps

    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Rep Power
    Great, that worked well thanks. I won't worry about the layers part just yet as I like to keep it simple. was thinking i could make it into a small pop-up box though and then make the cancel button shut the window down without doing anything. But this will do fine for now. Thanks again for your help.


Similar Threads

  1. Replies: 0
    Last Post: January 27th, 2004, 10:16 AM
  2. MySQL users
    By matteorr in forum MySQL Help
    Replies: 7
    Last Post: November 3rd, 2003, 11:17 AM
  3. Combination of confirm & alert problem!!!
    By Drax in forum HTML Programming
    Replies: 0
    Last Post: October 20th, 2003, 09:22 PM
  4. Using popup to confirm user action
    By John Cook in forum PHP Development
    Replies: 1
    Last Post: October 12th, 2003, 05:48 PM
  5. Using popup window to confirm action
    By Swobodin in forum PHP Development
    Replies: 3
    Last Post: October 11th, 2003, 05:49 PM

IMN logo majestic logo threadwatch logo seochat tools logo