Re: Question on javascript
| From: | Ben Williams | Date: | Fri, 22 Dec 2000 02:23:19 +0000 |
| Subject: | Re: Question on javascript | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-4594@lists.php.net to get a copy of this message | ||
i'm pretty sure it's not possible - php is purely server-side, javascript
is purely client-side. you can use php to write out javascript that will
be executed client-side, but you can't get javascript to interact with
php.
if i'm wrong, please correct me - i can't count the number of times i've
wanted to click on a button and call a server-side procedure or similar,
but afaik it can't be done.
you can kind of hack around it by going to another page when the button is
clicked (either via a form submit or some javascript redirect or similar)
that will then do the required processing, but it's klunky and
inefficient, and will probably introduce more bugs than it solves. but in
some circumstances, it's all you can do.
although i just had a thought - would it be possible to set a cookie value
in javascript and then have php read that cookie value further down in the
code?? anyone??
From Ben.
----- Original Message -----
From: "Lim Li Ping" <liping@mediaboxoffice.com>
To: "Dreamvale" <dreamvale@dreamvale.com>; "PHP Mailing list"
<php-windows@lists.php.net>
Sent: Friday, December 22, 2000 12:57 PM
Subject: Re: [PHP-WIN] Question on javascript
> Thank-you for the help.
>
> Is it possible then to assign a value to a php variable in a JavaScript
?
> For example, when an OnClick event becomes active, you will like to
assign a
> value to a PHP variable.
>
> Li.
> ----- Original Message -----
> From: Dreamvale <dreamvale@dreamvale.com>
> To: PHP Mailing list <php-windows@lists.php.net>
> Sent: Thursday, December 21, 2000 1:26 PM
> Subject: Re: [PHP-WIN] Question on javascript
>
>
> >
> > <script language=javascript>
> > ...
> > $javascriptvariables = "<? echo $phpvariable ?>"
> > ..
> > </script>
> >
> > hope this helps.
> >
> > ----- Original Message -----
> > From: "Lim Li Ping" <liping@mediaboxoffice.com>
> > To: "PHP Mailing list" <php-windows@lists.php.net>
> > Sent: Thursday, December 21, 2000 12:33 PM
> > Subject: [PHP-WIN] Question on javascript
> >
> >
> > Hi,
> >
> > How can I pass PHP variables to and fro from JavaScript ?
> >
> > Thanks in advance ,
> > Li