Darkmatter5 Posted July 10, 2009 Share Posted July 10, 2009 Here's the part of the URL "res_site-admin.php?ta=21&id=8" Here's the php code <?php $t=substr($_GET['ta'],0,1); $a=substr($_GET['ta'],1,2); if(isset($_GET['ta'])) { $even="#D2B48C"; $odd="#FFDEAD"; $rowtog=0; if($t==1) { echo "<table class='notice'><tr><td width='40' align='right'><b>Notices:</b></td><td>"; if(isset($_GET['er'])) { $er=$_GET['er']; if($er==1) { echo "User successfully edited!"; } elseif($er==2) { echo "User successfully deleted!"; } elseif($er==3) { echo "User successfully added!"; } } else { echo " "; } echo "</td></tr></table> <p class='section_text'>User management</p>"; } elseif($t==2) { include("$url/pages/siteadmin_t2.php"); } } else { echo "<span class='notice_text'>Choose a task above</span>"; } ?> Now in siteadmin_t2.php I have the following code <?php if(isset($_GET['id'])) { echo " value='" .$rpgbuilder->getdata("SELECT title FROM news WHERE article_id='$_GET[id]'"). "'"; } ?> but, $_GET['id'] doesn't seem to be present for siteadmin_t2.php to use. So in the include how can I ensure the URL variables are available to siteadmin_t2.php? Quote Link to comment https://forums.phpfreaks.com/topic/165488-include-file-question/ Share on other sites More sharing options...
Goose87 Posted July 10, 2009 Share Posted July 10, 2009 I haven't tested it, but an idea.. Add the: if(isset..... just before the include on the first script. This way it pulls the data from the first page, and can then use it in the sideadmin_t2.php as it's below that. Hope that helps. Goose. Quote Link to comment https://forums.phpfreaks.com/topic/165488-include-file-question/#findComment-872817 Share on other sites More sharing options...
rhodesa Posted July 10, 2009 Share Posted July 10, 2009 What is the value of $url? Because if you include a file like so: include('http://www.hostname.com/somefile.php'); you are actually running that script independently, and then including the output. if you want to include a local php script, use a filename instead of a url: include('pages/somefile.php'); Quote Link to comment https://forums.phpfreaks.com/topic/165488-include-file-question/#findComment-872818 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.