Re: button, parameter and reload - How do I glue it all together? [message #178791 is a reply to message #178785] |
Sat, 04 August 2012 06:00 |
Michael Vilain
Messages: 88 Registered: September 2010
Karma:
|
Member |
|
|
In article <ec8466e1-7d98-4750-bc1a-c1c11e0d7c2a(at)googlegroups(dot)com>,
mwoolley <trogoz2012(at)gmail(dot)com> wrote:
> I have a webpage, on which the content displayed depends on a parameter
> passed to or obtained by the webpage. This might be a $_GET variable, a
> $_SESSION variable or a cookie. I don't mind which is used. (I am open to
> suggestions as to which is the best method. I think $_SESSION.) When the
> page is initially displayed, the parameter is unset.
>
> On said page, there is to be a button, which when clicked, will increment the
> parameter and reload the page. Obviously, the parameter has to have the new
> value, so the reload causes the page contents to change. This ooperation
> might be repeated ad-nausem.
>
> Most of the indivual pieces of this (getting the paramter, and having the
> button reload the page) I can do, but I'm having trouble glueing it all
> together. I've managed to increment the parameter when the button is
> pressed, but only by calling an external form tag handler. If I do this, I
> can't get the page to reload.
>
> By what mechanism, can I have the button increment the parameter and cause
> the page reload?
>
> I hope this make sense; the old grey matter is addled today!
>
> Thanks in advance.
> Martin
So the logic of the php script, as I understand it is
script is called without any sort of argument in the URL and generates a
page.
The value for the variable is obtained through a $SESSION variable or
some default. A form with a button is displayed, possibly with a number
showing the value of the autoincrement variable.
Click on the button, which must be part of a form. The form submits the
page using the script $_SERVER['PHP_SELF'], passing the autoincremented
variable as a $_GET variable.
The resulting page displays, determines that $_GET[variable] is set, and
uses that value rather than the session
I don't see how reloading the page comes into this. When you click the
<button>, that should submit the form and redraw the page. a <button>
tag That's usually used for "hands off" automatic reloading.
If this isn't part of the logic you're trying to accomplish, correct me
where I don't have it right.
--
DeeDee, don't press that button! DeeDee! NO! Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]
|
|
|