Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2002
    Thanked 0 Times in 0 Posts

    Question PHP Alert script

    Anyone know if it's possible to generate an advisory alert window using php, if so, can they post the code? I've been searching and have come up with one using Java, but was wondering if this was possible with php?
    I have a poetry section on my site that will contain a section which will display adult type content. I'd like for viewers that choose to view the content in this section to be greeted with an alert window at the beginning and end of each page that's viewed provding them with an option to continue or exit to the default page.
    In other words:
    1. The user clicks the link to view the content and gets an alert advising on the nature of content and asked to continue or exit to the default page.
    2. Before the page finish loading; the user gets another alert asking the same question.

    I'd like to have it happen 3 times, that way the user has a full understanding of what they're about to get in to. I'm not sure if it matters if you use java or php, but I figure I'd ask and see.
    Any help on this is appreciated.
    Just Do It...

  2. #2
    Super Moderator
    Join Date
    May 2002
    Perth Australia
    Thanked 110 Times in 108 Posts
    Hi, this is really a javascript issue ... though you can use PHP to generate the javascript like so...

    <?echo "<script>alert('some_message');</script>";?>

    but I assume you will need a javascript 'confirm' box so moving you to javascript section ...
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  3. #3
    Regular Coder
    Join Date
    Jun 2002
    New York, USA
    Thanked 0 Times in 0 Posts
    this will warn somebody three times before loading a new page.

    <script language="JavaScript" type="text/javascript">
    function conf(){
    if(!confirm("are you sure?")) return false;
    if(!confirm("are you REALLY sure?")) return false;
    if(!confirm("are you POSITIVE?")) return false;
    return true;

    use an onclick statement like below in any link that you want to warn about:

    <a href="somepage.htm" onclick="return conf();">click</a>


Posting Permissions

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