PHP Hyperlink

Is there any possible way for me to call a php function with a hyperlink or something similar too it?
Thanks
Zeman4323Asked:
Who is Participating?
 
aabbasConnect With a Mentor Commented:
Below is the answer... enter url: http://domain/f.php?f=abc ........ and you will see. :)


<?php
// f.php
  function abc () {
    echo "ABC";
  }

  function xyz () {
    echo "XYZ";
  }

  $v = $_REQUEST["f"];

  $v();
?>

Best of luck.
0
 
CosminBCommented:
if you mean like when a user clicks a link or button from your page the answer is no

you can do something like this:
<a href="myscript.php?function=myfunction">Click me</a>
and in your php add
<?php
if ($_GET['function'] == 'myfunction')
{
  myfunction();
}
?>
0
 
Zeman4323Author Commented:
ok, thanks, didnt think an actual hyperlink was possible, but your way will work perfectly, thanks
0
All Courses

From novice to tech pro — start learning today.