Jump to content

include file question


Recommended Posts

Here's the part of the URL "res_site-admin.php?ta=21&id=8"


Here's the php code

  if(isset($_GET['ta'])) {
    if($t==1) {
      echo "<table class='notice'><tr><td width='40' align='right'><b>Notices:</b></td><td>";
      if(isset($_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?


Link to comment
Share on other sites

I haven't tested it, but an idea..


Add the:




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.



Link to comment
Share on other sites

What is the value of $url? Because if you include a file like so:


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:


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.