PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Say I have just a simple function that just outputs a string (for now)
First I out a link that suposed to call a function but it doesnt work...?
Anyone know how to do that?
Since you are calling the page itself in the url, then you could set a variable in the url rather than calling the function. Then create a switch statement that checks that variable and when it finds the value you specified it will call the function.
<?
echo "<a href="$PHP_SELF?id=1">Call a function</a>";
switch ($id) {
case $id == 1:
test();
break;
}
function test()
{
echo "WOW IT JUST CALLED A FUNCTION";
}
?>
Remember, no code is run after the server sends the page to the browser. If you want code to run client side you will have to learn a client side language like Javascript.