Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

How To Use A Link To Call Function In Php?


13 replies to this topic

#11 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 26 December 2009 - 07:35 AM

Is there any way call JAVASCRIPT function in PHP without any event How To Use A Link To Call Function In Php?

Is there any way call JAVASCRIPT function in PHP without any event

I am trying to call JAVASCRIPT function in php code what there is problem  with  the given function is  called automatically after some interval..

anyone please help me

Thank

-reply by ajay

#12 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 28 January 2010 - 08:17 AM

Go to another page by onclick()How To Use A Link To Call Function In Php?

I have a form.There I have written 2 radio buttons & 2 submit buttons.When I click on the radio button,its respective submit button is activated.But the problem is that,when I click the submit button,it doesn't open the page that I require.Also there is another problem.When I click on one radio button,its submit button is activate,but I want the other submit button should not be visible.

-reply by Smruti Ranjan Patri

#13 anoroll

    Newbie

  • Kontributors
  • Pip
  • 1 posts

Posted 30 April 2011 - 10:09 PM

This post is very old but I would thank you, it's help me too :-)
Thanks.

View PostSpectre, on 30 January 2006 - 03:43 PM, said:

It's not possible to call a function directly from a link, per se (as has been noted, PHP is server side), but you can construct a link to use GET variables to instruct the script to execute a certain function.

For example:

if( isset($_GET['function']) ) {
  switch( $_GET['function'] ) {
     case 'dosomething':
        dosomething();
     break;
     case 'dosomethingelse':
        dosomethingelse();
     break;
  }
}

And then link to script.php?function=dosomething

Hope that helps.

Oh, and Tyssen, using the link you originally supplied would cause nameOfYourFunction() to be executed whenever the script is, not just when the user clicks the link. Anything between <?php ?> (and, depending on server configurationm, <? ?>) is going to be processed as soon as the PHP engine encounters it within the script, so at the client's end, the link would end up pointing to whatever output nameOfYourFunction() returned (if any).


#14 Guest_dibo_*

  • Guests

Posted 02 November 2011 - 09:42 PM

several ways:
1- ajax // no need to reloade your page
2-$_GET (ex: if($_GET[x]==1)func(); or if(!empty($_GET[x]))func($_GET[x]);
3-javascript

Edited by moderator, 27 April 2012 - 09:15 AM.





Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users