Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #14408 > unrolled thread
| Started by | BobMCT <r.mariotti@fdcx.net> |
|---|---|
| First post | 2014-10-25 18:07 -0400 |
| Last post | 2014-10-26 19:33 +0000 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.php
Please help clear the cobwebs in my mind? BobMCT <r.mariotti@fdcx.net> - 2014-10-25 18:07 -0400
Re: Please help clear the cobwebs in my mind? Tim Streater <timstreater@greenbee.net> - 2014-10-25 23:26 +0100
Re: Please help clear the cobwebs in my mind? Vitriol Trollsbane <Vitriol@IDontEatSpam.ootikof.net> - 2014-10-25 23:47 -0400
Re: Please help clear the cobwebs in my mind? Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-26 19:33 +0000
| From | BobMCT <r.mariotti@fdcx.net> |
|---|---|
| Date | 2014-10-25 18:07 -0400 |
| Subject | Please help clear the cobwebs in my mind? |
| Message-ID | <g57o4a1tugkbgibt8ni3k3u1jing5pi3ht@4ax.com> |
Yep - this is a PHP question. Or maybe an HTML question. Or even a javascript question. At this point I don't know. What I do know is that I'm completely frustrated so excuse my tone. Here's what I have and what its doing (or NOT). In a working web page written in PHP I am reading in a purchase screen that contains a form with all the required information. When the submit button is clicked I wish to replace the element on the screen that contains all the information and replaces it with a Please wait . . . message and animated gif. The way I approached this first was to extract the elements from the form in my php program and just prior to call on the payment service I output a page with the please wait info. Then when control came back from the payment service I output the payment complete page. While it worked the way it should the payment completed screen was appearing below the please wait screen even though all the heading items were resent. So I needed another way to intervene. I created a javascript function that used a getelementbyid referencing the desired div and set it equal to the html code containing the please wait info. This seemed to replace the div content as expected. However, control NEVER gets back to the php program for further processing. I then tried changing what the div encapsulated, etc, etc. I'm kind of out of ideas at this time or burned out most of my gray cells or both. So, as the actual code is irrevelent can anyone shed some ideas as to how and/or what I need to do to make this happen. My original thought was that this should be really simple. Yet I'm banging my head. Thanks for any suggestions provided. Now back to the ice packs.
[toc] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2014-10-25 23:26 +0100 |
| Message-ID | <251020142326453149%timstreater@greenbee.net> |
| In reply to | #14408 |
In article <g57o4a1tugkbgibt8ni3k3u1jing5pi3ht@4ax.com>, BobMCT <r.mariotti@fdcx.net> wrote: > Yep - this is a PHP question. Or maybe an HTML question. Or even a > javascript question. At this point I don't know. What I do know is > that I'm completely frustrated so excuse my tone. > > Here's what I have and what its doing (or NOT). In a working web > page written in PHP I am reading in a purchase screen that contains a > form with all the required information. When the submit button is > clicked I wish to replace the element on the screen that contains all > the information and replaces it with a Please wait . . . message and > animated gif. The way I approached this first was to extract the > elements from the form in my php program and just prior to call on the > payment service I output a page with the please wait info. Then when > control came back from the payment service I output the payment > complete page. While it worked the way it should the payment > completed screen was appearing below the please wait screen even > though all the heading items were resent. > > So I needed another way to intervene. I created a javascript function > that used a getelementbyid referencing the desired div and set it > equal to the html code containing the please wait info. > > This seemed to replace the div content as expected. However, control > NEVER gets back to the php program for further processing. Well, why should it? When you submit a form, you specify an action which defines which page will load next. That page can contain some PHP code if you wish. That PHP code executes completely before the page is sent back to your browser. To state it more completely, the page that is sent back is whatever is generated as a result of that process. If the page is a mixture of HTML and PHP, then the resulting page will be based on the HTML and whatever output (using e.g. echo statements) the PHP generates. Once that has happened, that is *it* as far as the PHP is concerned; it has done all it is going to. So, don't make the mistake of thinking that the PHP is sitting there waiting for something; it isn't, because it's not running. If you want more PHP processing you have to submit a form again or make an ajax request. -- "People don't buy Microsoft for quality, they buy it for compatibility with what Bob in accounting bought last year. Trace it back - they buy Microsoft because the IBM Selectric didn't suck much" - P Seebach, afc
[toc] | [prev] | [next] | [standalone]
| From | Vitriol Trollsbane <Vitriol@IDontEatSpam.ootikof.net> |
|---|---|
| Date | 2014-10-25 23:47 -0400 |
| Message-ID | <vgro4a5ueiv17i67b602na482vre6rs56g@4ax.com> |
| In reply to | #14408 |
On Sat, 25 Oct 2014 18:07:44 -0400, BobMCT <r.mariotti@fdcx.net> wrote: >Yep - this is a PHP question. Or maybe an HTML question. Or even a >javascript question. At this point I don't know. What I do know is >that I'm completely frustrated so excuse my tone. > >Here's what I have and what its doing (or NOT). In a working web >page written in PHP I am reading in a purchase screen that contains a >form with all the required information. When the submit button is >clicked I wish to replace the element on the screen that contains all >the information and replaces it with a Please wait . . . message and >animated gif. The way I approached this first was to extract the >elements from the form in my php program and just prior to call on the >payment service I output a page with the please wait info. Then when >control came back from the payment service I output the payment >complete page. While it worked the way it should the payment >completed screen was appearing below the please wait screen even >though all the heading items were resent. > >So I needed another way to intervene. I created a javascript function >that used a getelementbyid referencing the desired div and set it >equal to the html code containing the please wait info. > >This seemed to replace the div content as expected. However, control >NEVER gets back to the php program for further processing. I then >tried changing what the div encapsulated, etc, etc. > >I'm kind of out of ideas at this time or burned out most of my gray >cells or both. > >So, as the actual code is irrevelent can anyone shed some ideas as to >how and/or what I need to do to make this happen. My original >thought was that this should be really simple. Yet I'm banging my >head. > >Thanks for any suggestions provided. Now back to the ice packs. Have you considered using JQuery to handle the display changes? http://www.w3schools.com/jquery/jquery_hide_show.asp
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-10-26 19:33 +0000 |
| Message-ID | <m2jiar$7j8$1@dont-email.me> |
| In reply to | #14408 |
On Sat, 25 Oct 2014 18:07:44 -0400, BobMCT wrote: [tl:dr;] Q: How can I maintain control of what is displayed in the browser whilst waiting for a request from the server? > Thanks for any suggestions provided. Now back to the ice packs. Ans: Use ajax to send the request and wait for the response, and javascript to update the displayed content as required. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web