Solved

PHP Hyperlink

Posted on 2004-03-31
3
3,181 Views
Last Modified: 2012-06-27
Is there any possible way for me to call a php function with a hyperlink or something similar too it?
Thanks
0
Comment
Question by:Zeman4323
3 Comments
 
LVL 6

Expert Comment

by:CosminB
ID: 10724260
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
 
LVL 2

Accepted Solution

by:
aabbas earned 125 total points
ID: 10724911
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
 

Author Comment

by:Zeman4323
ID: 10725803
ok, thanks, didnt think an actual hyperlink was possible, but your way will work perfectly, thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question