Jump to content

Recommended Posts

The problem is this.

 

index.php is this

 

<? include('main/index.php'); ?>

 

main/index.php is this

 

$content = $_GET['content'];
echo "con is $content";

 

when i put in index.php?content=blahblah

 

It echos 'con is', but if i change index.php to what main/index.php is, it con is blahblah.  Anyone know why?

Possibly important piece of information: index.php is on a subdomain, like sub.domain.com, and is including the file www.domain.com/main/index.php

 

I know the file is being included, because it outputs con is, but the variable is not working.

have you tried outputting the variable straight from the URL. Is it actually posting? Just examine it i'm sure it'll be something simple. If you see some contents of the included file then it doesn't matter about being on a subdomain etc. Just look at the get method and make sure it's back to itself.

 

<?php ECHO "$_GET['content']"; ?>

 

Snooble

The get variables are undefined if they are in the included file on the main site (www.domain.com/main/index.php) but they work perfectly on the regular subdomain file (sub.domain.com/index.php).  The code used in every case was the exact same, the only difference is that it is either included or is not.

so you're saying the included file doesn't get the $_GET variables? something like this?...

 

page1.php

<?php
include('page2.php');
?>

 

page2.php

<?php
echo $_GET['test'];
?>

 

a call to page1.php?test=test doesn't do anything?

 

sounds like a server problem....

Sorry, I made a mistake in what I was saying earlier, the correct representation of my problem is as follows.

 

sub.domain.com/page1.php

<?php

include('http://www.domain.com/main/page2.php');

?>

 

www.domain.com/main/page2.php

<?php

echo "Test is ";

echo $_GET['test'];

?>

 

http://sub.domain.com/page1.php?test=test returns

Test is

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.

Guest
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.