vividona Posted March 6, 2010 Share Posted March 6, 2010 Hi, I have 3 functions function1(); // top rated posts function2(); //top commented posts function3(); //high rating posts and I have a table with three tabs | Tab1 | Tab2 | Tab3 | I need onclick on any tab, load one of my 3 functions Quote Link to comment https://forums.phpfreaks.com/topic/194311-loading-function/ Share on other sites More sharing options...
Redlightpacket Posted March 6, 2010 Share Posted March 6, 2010 I believe you need to check out the GET[]. Quote Link to comment https://forums.phpfreaks.com/topic/194311-loading-function/#findComment-1022220 Share on other sites More sharing options...
Redlightpacket Posted March 6, 2010 Share Posted March 6, 2010 Excuse me, GET[] ---------->>> GET Quote Link to comment https://forums.phpfreaks.com/topic/194311-loading-function/#findComment-1022221 Share on other sites More sharing options...
vividona Posted March 6, 2010 Author Share Posted March 6, 2010 anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/194311-loading-function/#findComment-1022240 Share on other sites More sharing options...
Zane Posted March 6, 2010 Share Posted March 6, 2010 That's a fine idea you have there vividona, but noone's gonna be able to help you out very much unless you show us what you've already attempted. No one is going to code it for you. Quote Link to comment https://forums.phpfreaks.com/topic/194311-loading-function/#findComment-1022274 Share on other sites More sharing options...
PFMaBiSmAd Posted March 6, 2010 Share Posted March 6, 2010 The only thing browsers can make to web servers are HTTP/HTTPS requests. They cannot directly 'call' php code on a page or php functions within that code. They make requests for URL's. The HTTP/HTTPS request that results from clicking on each individual tab/link must contain enough information so that the php code on the requested page can determine what action to take. One way to do this would be to use a GET parameter on the end of the URL, something like http://your_domain.com/some_page.php?tab=some_value1, http://your_domain.com/some_page.php?tab=some_value2, http://your_domain.com/some_page.php?tab=some_value3, ... You would then access the value of the GET parameter 'tab' by referencing $_GET['tab'] in your code. Quote Link to comment https://forums.phpfreaks.com/topic/194311-loading-function/#findComment-1022328 Share on other sites More sharing options...
Zane Posted March 6, 2010 Share Posted March 6, 2010 Given that information... you really only have two options in the matter (well four if you count POST) 1.) You can use the browser to make this request.. onClick ; known as client-side 2.) You can do as PFM suggested and set the tabs as anchor links to preset URLs .. containing relevant GET/POST information to perform a server-side function. There is no wrong option here, though the second one is less of a hassle. In a client-side request.. data can be manipulated. Also since it's client-side, users have the ability to disable their functionality on your site;Most people call this "turning off Javascript" This rendering all your work and motives pretty useless. Though it's really all in how you code it. A good programmer knows how to use the noscript tag as well. Quote Link to comment https://forums.phpfreaks.com/topic/194311-loading-function/#findComment-1022419 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.