Jump to content

[SOLVED] PHP Call function with href


Halisco

Recommended Posts

Im trying to use href to call a function.  THe application works when i use the link but it is also calling he function when i load the page with a list of these links. How can i fix this?

Here is my script:

 <?	echo "<a href=\"" . FunctionOne($ID) . "\">Call Function One</a>"; ?>

 

Link to comment
Share on other sites

This is javascript not php bro ...

 

Thanks for stating what i am doing wrong but not offering any input as a solution. 

 

come on now, let's not get nasty. We are all here volunteering help!

 

 

If he doesnt know how to help me then dont bother posting a reply.  And if he does know how to help and does not "volunteer" the info then dont bother replying then either.  Ive been googling this for a while with no success and now with frustration with a reply from and A****le like him.  So please if you dont have a positive or helpfull reply then don't bother.  Forums are about helping not ridiculing people.

Link to comment
Share on other sites

Bro your aking for help on a javascript question in a PHP board ... What's your problem? I am a PHP developper not a JavaScript freak. I don't care how much big your fraustration is over the prob you have, thats not excusing the fact that you're still not in the good place for help.

 

Here take my hand and let me bring you in the good part of the board ...

http://www.phpfreaks.com/forums/index.php/board,6.0.html

 

this guy is incredible :P

Link to comment
Share on other sites

Bro your aking for help on a javascript question in a PHP board ... What's your problem? I am a PHP developper not a JavaScript freak. I don't care how much big your fraustration is over the prob you have, thats not excusing the fact that you're still not in the good place for help.

 

Here take my hand and let me bring you in the good part of the board ...

http://www.phpfreaks.com/forums/index.php/board,6.0.html

 

this guy is incredible :P

 

So your telling me there is no way to call a PHP function from within href without using javascript? If that is the case that should have been your original reply.  Simply telling someone "thats javascript bro not PHP" is not a clear answer.

 

I think you should learn some Forum etiquette.  You may learn this one day when you ask a question about somthing that is not your Forte and someone wastes your time with snarky remarks.  If you dont learn any furhter etiquette please do not reply to any of my future posts.  It would be much appreciated.

 

PS> thanks for possibly leading me in the right direction....

Link to comment
Share on other sites

Ok ladies, a work around would be this:

<?php
echo '<a href="'.$_SERVER[php_SELF].'?function=1">Click here to call a function</a>';

if(isset($_GET['function']))
{
foo();
}
?>

 

I don't know about calling a function directly on click. You could try

echo '<a href="#" onclick="'.foo().'">Function</a> but I don't know if it'll work.

Hope that helps.

Link to comment
Share on other sites

Ok ladies, a work around would be this:

<?php
echo '<a href="'.$_SERVER[php_SELF].'?function=1">Click here to call a function</a>';

if(isset($_GET['function']))
{
foo();
}
?>

 

I don't know about calling a function directly on click. You could try

echo '<a href="#" onclick="'.foo().'">Function</a> but I don't know if it'll work.

Hope that helps.

 

No that would be a JavaScript syntaxes. PHP is parsed before HTML. When the page is loaded the PHP is static and can't do stuff dynamically unless you use AJAX

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.