Re: onClick
| From: | Jonathan Duncan | Date: | Mon, 03 Dec 2001 23:03:14 +0000 |
| Subject: | Re: onClick | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14787@lists.php.net to get a copy of this message | ||
Richard
That is good information. Thank you very much for your help.
Jonathan
"Richard Crawford" <rscrawford@mossroot.com> wrote in message
news:3C0BF54F.2080203@mossroot.com...
> Not directly, no. You can call a JavaScript function with the onClick
> command, but not a PHP function.
>
> But here's what I've done when I needed to do something like that.
>
> Create a separate page for the function, like function.php. Then in the
> anchor tag in your main page (call it index.php), call that page...
> e.g., < a href="function.php >click me for a function< /a >, passing
> parameters either in the URL or by cookies.
>
> Your function page might look something like this:
>
> <?php
> {insert data into db here}
> header("Location: index.php");
> ?>
>
> In other words, in function.php, the code does the function and then
> immediately issues a redirect command to send the user back to the page
> where they started.
>
> You could also include the function in the code for index.php, and
> simply have the anchor tag link back to index.php, passing parameters
> via your favorite parameter passing technique.
>
> Jonathan Duncan wrote:
>
> > Is it possible to call a PHP function using the "onclick" parameter?
>