Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

To handle the event onClick using PHP

Status
Not open for further replies.

Ducu

Programmer
Oct 2, 2003
30
RO
Hi !

I want to write a handle using PHP for the onClick event of a link tag (<a href=&quot;...&quot; onclick=myfunction() target=&quot;...etc &quot;>bla bla</a>). i.e.

<? php
function myfunction()
{
}
?>

I tried but it didn't work at all.
This function could be written only as JavaScript script function ??

Thank you in advance,
Ducu
 
Yes, JavaScript (or VB script in internet explorer). PHP is a server technology that is it executes on a web server not at the client.
 
Yeah, onClick is a javascript function and only works client side. PHP is a server side language so all the php has been executed and finished (or nearly finished in most cases) with before the page has anything to click on.
You could use jabascripts onClick event to reload the page with the appropriate variables to execute the php code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top