SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist spoondevil's Avatar
    Join Date
    Jun 2001
    Location
    Harlow, Essex, UK
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Prompt To Delete Item

    Okay...

    I want to be able to offer a "second-chance" to the administrator of a web site I am doing, by offering them a pop up prompt that they have to accept before the item is deleted from the database.

    Simply I would like to have a delete link, which when clicked says "are you sure you want to delete this message?"

    I have, so far, got this:
    <a class="small" href='javascript:onClick=alert("are you sure you want to delete this message?")'><img src="../images/delete.gif" width="15" height="14" border="0" alt="Delete This Message"></a>
    but I can't figure out where to put the destination url.

    Secondly, I would ideally like the alert prompt to state the message title and name of submitter ($subject and $name). Is this possible? The database is bigworm_website and the table is messages.


    Regards
    Gunter

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    <a class="small" href='javascriptnClick=alert("are you sure you want to delete this message?")'><img src="../images/delete.gif" width="15" height="14" border="0" alt="Delete This Message"></a>
    Try this:
    Code:
    <a class="small" href="#" 
    onclick="return confirm('are you sure you want to delete message \"<?php echo($subject);?>\" 
    from <?php echo($name);?> ?');">
    Replace your opening <a> tag with this and you should get the effect you want.

  3. #3
    SitePoint Evangelist spoondevil's Avatar
    Join Date
    Jun 2001
    Location
    Harlow, Essex, UK
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers for that

    I had to play about with the PHP (due to Dreamweaver) on it, but it works a treat now.


    Regards
    Gunter


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •