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?


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to