Let me start by saying I'm not sure if this is a PHP or Javascript problem. Here's the situation:

I have an HTML page that displays a Modal Window when it loads. The window is a small form, which is optional. If the viewer decides to fill it out, when they click the Submit button the form is validated and, if all is okay, the window is removed and the form data sent (via action=) to a PHP routine for further processing.

I would like the viewer not to be aware of the PHP routine running (there are no messages sent to the viewer from this routine).

I have tried ending the routine with

echo "<script>history.back();</script>";

and that returns the viewer to the HTML page without the Modal window being redisplayed in every browser that I've tried, except for IE, which redisplays the HTML page (with the Modal Window active). So, I have 2 questions:

1) Is it possible to have the PHP routine run in the background (so the viewer never leaves the HTML page?

2) If not, is there a way to have IE just return to the HTML page without reloading it?

Thanks in advance for your help.

    Sounds like what you're wanting is client-side behavior - moving to ClientSide Technologies forum.

    It sounds like what you want to do is submit a form without causing the user to actually navigate away from the current page. If so, I'd suggest you take a look at an AJAX approach which uses Javascript to make a POST (or GET, if you prefer) request in the "background" so to speak, meaning the location in the browser window never changes despite the communication with your server after the user submits the form.

      bradgrafelman.

      Thank you for your response. I've actually looked at AJAX, but I really don't have time to learn a totally new language (even if it is Javascript base). Is that my only option? Is there an AJAX forum where someone would be willing to help me with the code?

      Again, thanks in advance for your help.

        Well, it's not a totally new language, just using an object available in an existing language (unless you're talking about jQuery, which in this instance is again not so much a new language as cross-platform wrappers to simplify common uses of the Ajax idiom).

          Weedpacket.

          I appreciate your reply, although I'm not sure I understand what you said. Is there a forum where someone could assist me in setting up the AJAX code?

            Lynda is a pretty good tutor..

            Otherwise, google has a lot of examples to select from and this place here is good if you get stuck along the way. Happy Learning!

            J

              a month later

              Download phpAdsNew and look at the fakecron.php file. It "fakes" cron by running a background process triggered by a 1x1 pixel image placed on the page you want to trigger the background operation.

                jimweinberg;11027181 wrote:

                Weedpacket.

                I appreciate your reply, although I'm not sure I understand what you said. Is there a forum where someone could assist me in setting up the AJAX code?

                He said something like

                The Weedpacket Translator wrote:

                AJAX isn't a new language, it's just something you can do with Javascript, unless you are specifically talking about using AJAX from a Javascript framework (he mentions jQuery {other Javascript frameworks are MooTools, YUI, Scriptaculous, many others}) --- which isn't a language, but a framework that exists to simplify common Javascript use cases (like AJAX).

                AJAX stands for "Asynchronous Javascript And XML" ... and I think we all better get used to the idea. Maybe not this week, or this month, but we're going to be less and less relevant as web programmers if we can't perform these sort of tasks.

                Granted, not everyone is a "web programmer" ...

                  Write a Reply...