locked
Popup problem RRS feed

  • Question

  • I have a php page that, once it executes, I want to return to an html page. But when I test it, I get a message that the popup is blocked. If I allow popups, it works, but I want the user to continue to the next page despite popup settings.

    The page that calls the php is https://www.JolyonHallows.com/StoriesLogin.html. On that page, there's a form that submits to https://www.JolyonHallows.com/Mailer.php. There's nothing on that page visible to the user. I want the user to go to https://www.JolyonHallows.com/Stories.html. The php code (I'm still in test mode so it isn't complete) is:

    <?php
    $firstname = $_POST['firstname'];
    $email = $_POST['email'];
    $msg = "First name: " . $firstname . "Email: " . $email;
    // use wordwrap() if lines are longer than 70 characters
    $msg = wordwrap($msg,70);

    // send email
    mail("jhallows@jhallows.com","Reader for my stories",$msg,"From: Jhallows@westwindconsulting.com");
    ?>
    </body>
    <script type="text/javascript">
    Mywindow=window.open ("Stories.html","","");
    Mywindow.focus;
    </script>

    Alternatively, I'd like to add the php code to /StoriesLogin.html, but I don't know how to invoke that code since the submit option requires a separate page.

    Any ideas.

    Thanks.

    Wednesday, November 14, 2018 2:15 AM

Answers

  • You could try to go to a new location rather than opening a new window.

    <?php 
        echo "<script>location.href='Stories.html';</script>";
    ?>
    See if that avoids the popup error.


    Kathleen Wilber
    BrightWillow - Asp.Net Applications


    • Edited by KathyW2 Wednesday, November 14, 2018 5:20 AM
    • Marked as answer by Jolyon Hallows Wednesday, November 14, 2018 5:42 AM
    Wednesday, November 14, 2018 4:21 AM

All replies

  • You could try to go to a new location rather than opening a new window.

    <?php 
        echo "<script>location.href='Stories.html';</script>";
    ?>
    See if that avoids the popup error.


    Kathleen Wilber
    BrightWillow - Asp.Net Applications


    • Edited by KathyW2 Wednesday, November 14, 2018 5:20 AM
    • Marked as answer by Jolyon Hallows Wednesday, November 14, 2018 5:42 AM
    Wednesday, November 14, 2018 4:21 AM
  • It worked. I got two suggestions from you. One was:

    <?php

    header('Location: https://JolyonHallows.com/Stories.html');
    exit();

    The other was:

    <?php
       echo "<script>location.href='Stories.html';</script>";

    Both of them work. So thank you.

    Jolyon Hallows

    Wednesday, November 14, 2018 5:53 AM