alen Posted February 12, 2007 Share Posted February 12, 2007 Hi there! I have this simple include script, <?PHP $incpath = "include"; $default = "index"; $getarray = "side"; $filendelse = "php"; if (isset($_GET[$getarray])) { include_once ("$incpath/".$_GET[$getarray].".$filendelse"); } else { include_once ("$incpath/$default.$filendelse"); } ?> Well, you can probably see what it does. The links are as simple as this, index.php?side=page - how can I make it be something like this, index.php?side=test&id=whatever or something like that... How can I play with this script? Are there any guides or something on the net which explains include basics? And I donæt mean php.net Link to comment https://forums.phpfreaks.com/topic/38228-solved-include-stuff/ Share on other sites More sharing options...
redarrow Posted February 12, 2007 Share Posted February 12, 2007 what do you need to no as what i can see your code is correct. Link to comment https://forums.phpfreaks.com/topic/38228-solved-include-stuff/#findComment-183113 Share on other sites More sharing options...
jcbarr Posted February 12, 2007 Share Posted February 12, 2007 Need to know where the id is coming from. It has to be defined from somewhere before you can add it to the url. Link to comment https://forums.phpfreaks.com/topic/38228-solved-include-stuff/#findComment-183117 Share on other sites More sharing options...
alen Posted February 12, 2007 Author Share Posted February 12, 2007 Nevermind the id then, index.php?side=test&side=whatever - This takes me to not the test page, but the whatever page. Link to comment https://forums.phpfreaks.com/topic/38228-solved-include-stuff/#findComment-183130 Share on other sites More sharing options...
trq Posted February 12, 2007 Share Posted February 12, 2007 I'm not exactly sure what your question is but you cannot include url variables within an include file. eg; include "index.php?side=test&id=whatever" Will NOT work. Take a look at the manual for details. Link to comment https://forums.phpfreaks.com/topic/38228-solved-include-stuff/#findComment-183132 Share on other sites More sharing options...
jcbarr Posted February 12, 2007 Share Posted February 12, 2007 I wouldn't define the side variable twice in the URL like that. The question is still the same. Where is the "whatever" coming from. Is this something that is submitted via a form, or is it coming over through the URL to this script? Link to comment https://forums.phpfreaks.com/topic/38228-solved-include-stuff/#findComment-183133 Share on other sites More sharing options...
alen Posted February 12, 2007 Author Share Posted February 12, 2007 I'm so stupid. I'm sorry for all the troubles, but I figured it out. Thanks for the effort. Link to comment https://forums.phpfreaks.com/topic/38228-solved-include-stuff/#findComment-183148 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.