i must be stupider than you thought!<

liunx

Guest
at my blog, i'm having problems getting my archives to show up. locally (localhost), they do just fine, but when i upload the files to the 'net, it stops working.

here's what i'm talking about:
<a href=http://www.htmlforums.com/archive/index.php/"?z=2002_10">oct 2002</a>
<?
if (isset($z))
{include("archive/"."$z".".php");}
else
{include("_blog_content.php");}
?>the page loads in _blog_content.php, unless you've clicked on a link to the archives. in that case, $z should be set, and you'd get archive/$z.php loaded in instead.

i've even set up an echo to test whether i'm getting anything back from $z or not, and i get nothing! i don't get it!

here's the blog page (<!-- m --><a class="postlink" href="http://www.meat-thing.com/transmothra.com/blog/">http://www.meat-thing.com/transmothra.com/blog/</a><!-- m -->). the archives are in the sidebar, way down. actually, it's the OLD archives that i'm talking about.

TIA for any suggestions or hints!This sounds like a classical register globals problem... Chances are that globals are turned off on your remote host, in which case you can't access 'z' using $z, but with $_GET['z'] ... Just try an echo $_GET['z']; and see what if you get anything...
It's also nice to run some checks on the variable, since you're using it for including pages.. check the syntax etc.thanks, Rydberg! i'm now using
<? echo $_GET['z']; ?>
and
<?
if (isset($z))
{include("archive/".$_GET['z'].".php");}
else
{include("_blog_content.php");}
?>
...but only the echo seems to work. the include doesn't. i don't understand what the problem could be!if( isset($_GET['z']) )

you still just have $z :)Originally posted by n8thegreat
if( isset($_GET['z']) )

you still just have $z :)
thanks... er, what's that mean? shouldn't that still work? i mean, you click on the link, and it should set a value to it, right?what? unless you specifically declare $z = $_GET['z']; you have to use $_GET['z'] throughout the whole page, just like you did with the echo. so there fore your code needs to be changed to

<?
if (isset($_GET['z']))
{include("archive/".$_GET['z'].".php");}
else
{include("_blog_content.php");}
?>Originally posted by n8thegreat
what? unless you specifically declare $z = $_GET['z']; you have to use $_GET['z'] throughout the whole page, just like you did with the echo. so there fore your code needs to be changed to

<?
if (isset($_GET['z']))
{include("archive/".$_GET['z'].".php");}
else
{include("_blog_content.php");}
?>
aw, crap, i can't believe i missed that! thanks n8 :D works a charm now!
 
Back
Top