RE: [PHP-WIN] pass javascript variable to php?
| From: | Tim Foster | Date: | Thu, 08 Nov 2001 15:38:33 +0000 |
| Subject: | RE: [PHP-WIN] pass javascript variable to php? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-10298@lists.php.net to get a copy of this message | ||
If I'm understanding your situation correctly, there is a way to do this (although, the
greatest concern here is that you're going to be creating a situation that the user is not
expecting ..and that causes usability challenges).
Here's how you'd do it: When the user clicks on the checkbox, a javascript (onFocus())
function GETS a webpage on the server and passes it the checkbox, userid and other
relevant information. The server processes it and returns a "302" (you'll have to
check
this one out because I'm not sure that 302 is right). The 302 tells the browser to NOT
load a new page.
The net result: data is sent to the server (probably w/o the user knowing it happened) and
the page is not refreshed.
Just make sure that the Submit button does indeed get the user off the page otherwise
they're stuck.
TIM
-Looking for a helping hand? There's one on your arm.
> -----Original Message-----
> From: Mike Flynn [mailto:mike@mikeflynn.net]
> Sent: Wednesday, November 07, 2001 10:33 PM
> To: aaron
> Cc: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] pass javascript variable to php?
>
>
> At 07:02 PM 11/7/01 -0800, you wrote:
> >I've got checkbox that I get the status of with javascript and I put the
> status into a javascript variable. How do I get that variable over to php?
> >I don't want to hit the submit button to get the variable into php.
> >
> >Thanks,
> >Aaron
>
> Not possible. It doesn't make sense to think of it like that. And even if by
> some time-space fracture you could, it wouldn't do anything. :) PHP is
> SERVER-SIDE. JavaScript is CLIENT-SIDE. Never the twain shall meet, except
> via loading a new page with certain parameters.
>
> -Mike
>
>
>