Re: Php inside Javascript
| From: | Chris Hayes | Date: | Thu, 24 Aug 2000 23:07:15 +0000 |
| Subject: | Re: Php inside Javascript | ||
| References: | 1 | Groups: | php.general php.general |
| Request: | Send a blank email to php-general+get-13545@lists.php.net to get a copy of this message | ||
> > I have a query insida a javascript function which is triggered by an
> > onclick event,
> > but the query is executed when the page is loaded instead when the event
> > occurs. Hope someone have a suggestion what to do.
> > print "<INPUT Type='BUTTON'
Value=' Spara poster '
onclick=sparapost()>;
(I'm missing the closing " here.)
Anyway. But. MAYBE if I'm seeing it right you want the PHP to be executed on
a condition in javascript.
But that's not possible this way: when a page is requested ALL php is done,
no matter whther it's inbetween javascript. Even if you would force the php
to be written ion the page so it is not done at the server, it won't happen
at the user side.
The way to do it is on the condition you make in javascript call the same or
another page with the right method to pass variables. Like using GET for
small amounts and a form (i.e. POST) for loads of variables.
hth,
Chris
--------------------------------------------------------------------
Chris Hayes
Droevendaalsestg. 35
6708 PB Wageningen
the Netherlands
http://www.xs4all.nl/~chayes/