Jump to content

GET variables not working when I include the file.


JJBlaha

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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.

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.