Another way to pass data from JavaScript <-> PHP is with cookies.

Use JavaScript to set the cookie and once you reload the script, PHP will
have access to the variables stored in the cookie.

I implemented this in a real-time trivia game (using PHP for the backend
logic, and JavaScript for the client-side logic), and it worked quite well.


-----Original Message-----
From: Mike Flynn [mailto:[EMAIL PROTECTED]]
Sent: April 2, 2002 13:34
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Passing Javascript Variables to PHP


I have answered variations on this question at least 3 times.  Please check
the archives.  JavaScript is client-side, PHP is server-side.  The only way
to go from JavaScript to PHP (in that direction) is by going to a new page
-- 1. Reloading the current page, with the relevant data in the query
string; 2. Loading a new page, with the relevant data in the query string;
3. Submitting a form, with the relevant data in hidden or other kinds of
fields.

-Mike

At 07:09 PM 4/2/02 +0100, Wayne Hinch wrote:
>Hi all,
>
>Does anyone know if it is possible to pass variables from JavaScript to
>PHP?
>
>Any help will be much appreciated
>
>Many Thanks



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to