Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3191
  • Last Modified:

PHP Hyperlink

Is there any possible way for me to call a php function with a hyperlink or something similar too it?
Thanks
0
Zeman4323
Asked:
Zeman4323
1 Solution
 
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
 
aabbasCommented:
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
 
Zeman4323Author Commented:
ok, thanks, didnt think an actual hyperlink was possible, but your way will work perfectly, thanks
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now