|
Posted by OmegaJunior on 12/27/06 14:57
Welcome!
For AJAX you can hit Google. It's the new hype today, as people believe =
=
they invented the wheel.
Cheers!
On Tue, 26 Dec 2006 14:53:46 +0100, Charles O'Flynn <carles@matchwalk.co=
m> =
wrote:
> Thank you very much for this - the HTML bit I was reasonably aware of =
but
> I'm not sufficiently familiar with PHP to have been able to work that
> without some help.
> I'll try it out tomorrow when I get back to my PC.
> Just out of interest, the AJAX method sounds as though it is what I
> originally had in mind. Where can I get more information on it? It =
> would
> have been nice to have the location change without having to press a =
> submit
> button.
> Thanks again!
> Charles
>
>
>
> "OmegaJunior" <omegajunior@spamremove.home.nl> wrote in message
> news:op.tk47vvww70mclq@cp139795-a.landg1.lb.home.nl...
> On Tue, 26 Dec 2006 00:47:55 +0100, Charles O'Flynn =
> <carles@matchwalk.com>
> wrote:
>
>> Can anyone help, please?
>> I am writing a program that has a drop-down list to allow the user to=
>> change
>> one of the variables. The drop-down is coded in HTML. I know how to=
>> refresh the screen in HTML but not in PHP.
>> The idea is to re-draw the screen with one of the variables re-define=
d,
>> thereby producing a completely different display. Possibly my
>> fundamental
>> approach is wrong, but I'm not particularly experienced in this sort =
of
>> thing, and this is the best I can come up with. For reference, the p=
age
>> is
>> at http://dev.matchwalk.com - click on 'Weather forecast' under 'Rela=
ted
>> links'. I want to be able to alter the location to which the forecas=
t
>> refers.
>> Thanks in advance for any suggestions.
>> Charles
>>
>>
>
> If you already know HTML form submitting techniques, this should be
> relatively easy to understand.
>
> In your current setup, you have a form named "weatherForm" with a "get=
"
> method, but without an action attribute. Instead, you use a javascript=
ed
> "updatelocation" method that reacts to the onSelect event of the dropd=
own
> list.
>
> There is a set of methods named "AJAX" that allows you to load new
> information dynamically, based on javascript methods. Though this is a=
> very nice way of handling it, it's also extremely cumbersome compared =
to
> the "old school" technique of simply submitting the form.
>
> How to do it:
> Add a submit input to your form and title it aptly, like "Go". Add an
> action attribute to your form, and as its value you assign the name of=
=
> the
> current script. So basically you're submitting the form to its own pag=
e.
>
> Then in the current script, before building the rest of the page, you =
=
> read
> the querystring using the variable $_GET['location'] (PHP 4 and up wil=
l
> create this variable for you automatically because the form was
> submitted). Upon knowing the location, you choose the correct data to
> present. If that variable isn't filled in (check with
> if(isset($_GET['location'])=3D=3Dtrue)), show a default location of yo=
ur
> choosing.
>
> Hope this helps!
>
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
[Back to original message]
|