Terje_Hvidsten Posted March 8, 2011 Share Posted March 8, 2011 Hi, I'm an novice/intermediate PHP prgogrammer, so excuse me if this is a stupid question. I have one php program that consist of a few functions. Inside the function taht is the starting point I pickup a few entries from a MYSQL database, and display those in my html page. I wish to dynamically put a link on those entries that makes it possible for the users to click those entries an get directed to other functions inside this very same PHP program WITH a parameter. The parameters that should accompany the url/link into the selected function to be able to select apropriate records from the mysql tables. Any hints and tips for this would be highly appreciated! Kind Regsrds, Terje Hvidsten. Quote Link to comment Share on other sites More sharing options...
gristoi Posted March 8, 2011 Share Posted March 8, 2011 You need to use the get parameter. This allows you to pass variables into the URL: Http://www.somesite.com?var1=something&var2=somethingelse&functionparam=function1 // to get data from URL If ($_Get['functionparam']=='function1') { $var1 = $_GET['var1']; // run function } I hope this is what you are referring to Quote Link to comment Share on other sites More sharing options...
Terje_Hvidsten Posted March 8, 2011 Author Share Posted March 8, 2011 Thanx. I have tried out something like that with no success. It might be that I should have supplied some more information. This is running on a Zikula site where I have the link http://www.myweirdsite.no/index.php?module=4-GO, where "4-GO" is the directory in my "modules" directory in the Zikula structure. And the php procedure inside this directory that starts is index.php. Inside this "index.php" I have a function() called DisplayPlaces which I want to go to when a user hit one of the 3 linkes on the starting page. When I now hit the link I get the URL http://www.myweirdsite.no/index.php?module=4-GO&func=DisplayPlaces , but I'm still on page 1? And I also see that I can type whatever I wish in after the func=????????? and I don't even get an error message; just displaying the first page.. Kreg, Terje. Quote Link to comment Share on other sites More sharing options...
gristoi Posted March 8, 2011 Share Posted March 8, 2011 How are you retrieving the data from the URL in the index.php. Where's your code to trigger the function? Example: If ($_GET['func']) { switch($_GET['func']) { case 'DisplayPlaces' : DisplayPlaces(); Break; ....................... } } Quote Link to comment Share on other sites More sharing options...
Terje_Hvidsten Posted March 8, 2011 Author Share Posted March 8, 2011 THANX A MILLION TIMES!!!! Put Your code sample in my 4-GO php and it was triggered!! Even if the displayed page was a bit "funny" the code was working, so now I can continue my "adventure"! Thanx a lot for the help! Kind Regs, Terje Hvidsten. Quote Link to comment Share on other sites More sharing options...
gristoi Posted March 8, 2011 Share Posted March 8, 2011 Lol, have fun Quote Link to comment 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.