Jump to content

Onclick With Php


Grabeorama

Recommended Posts

Is it possible to call a PHP function with 'onclick'?like if I had:<input type="button" onclick="php_function()" value="click">or would it have to be in JS?
No, you cannot make a PHP function happen after the page is loaded. PHP is a Preprocessor.
Link to comment
Share on other sites

  • 4 weeks later...

I was facing the same problem and all I found was no for an answer. Well, surprise. Not exactly with onclick since that is JS, but there is way to basicly the same with PHP/HTMLHere is an example:

 <?phpfunction myfunction(){echo("<strong>I love PHP !</strong><br>");}?><a href="<?php echo("$PHP_SELF?execute=myfunction")?>">click to execute myfunction ! </a><p><?php if ( isset($execute) ){myfunction();}?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...