In general:
We made a script which did this, however a bit limited because of the
client/server-problems mentioned.
The script is part of a registration-form, and pick out a city based on the
zip entered. We didn't want the list of zipcodes and cities in JS since it
would be quite huge.

Don't remember the excacts but in general: (simplified model)
<form name=oFrm>
 <input name=zip onBlur='fetch();'><input name=city>
</form>

Fetch() is a function that opens a new pop-up window at 50x50px, and set the
url-property of this window using JS (ex:)
 var strURL = "find_city.php?zip=" + document.oFrm.zip.value;

The find_city.php script recieves the zip in a get-var, and can connect to
mysql and retrieve the city etc. and closes itself.

find_city then outputs JS (ex):
<script>
 opener.document.oFrm.city.value = "$the_right_city";
 self.close();
</script>

The "drawbacks" here is a window flashing a short second or so...
You can make this thing run queries or whatever...

Wrote the above from memory, so the syntax might be a bit of, but the flow
is the same.

have a nice day!
-Jørg V. Bryne
----- Original Message -----
From: "Patrice ROTH" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 16, 2001 10:04 AM
Subject: [PHP] javascript and php


> It is easy to generate javascript through php,but how to call php through
> javascript.
> In fact, I'd like to update some form fields according to events on other
> fields. I can do this using javascript, but the values should be readed in
a
> MySql database.
>
> Thank's
> Patrice
>
----- Original Message -----
From: "Soeren Staun-Pedersen" <[EMAIL PROTECTED]>
To: "Patrice ROTH" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, January 16, 2001 10:08 AM
Subject: Re: [PHP] javascript and php


> > It is easy to generate javascript through php,but how to call php
through
> > javascript.
> > In fact, I'd like to update some form fields according to events on
other
> > fields. I can do this using javascript, but the values should be readed
in a
> > MySql database.
>
> You're in a serverside, clientside problem. You want the client to execute
> the PHP code, which it cannot. If you want to update the form fields with
> some other data, you have to provide the page you sent to the client with
> all the needed data beforehand.
>
> Regards,
>
> Soeren Staun-Pedersen - [EMAIL PROTECTED]
> ------
> "The internet is full, beat it"
>     - Me.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to