Jump to content


This topic is now archived and is closed to further replies.


Passing Variables w/ PHP 5.1.5

Recommended Posts

I have a portion of code in my PHP program that works on my personal server, but not on the freshly installed server here at work... Originally, my server had PHP version 4.3.11, whereas my new server has PHP 5.1.5. Here is the problem... This snippet of code no longer can pass the variables to the next page:

<a href="export.php?w=1&amp;month=<? echo $today_month; ?>&amp;year=<? echo $today_year; ?>&amp;listorder=<? echo $listorder; ?>&amp;filename=<? echo $thefilename; ?>" name="2excel" class="print" target="_blank"><img src="images/excel.gif" border="0"> <b>Export to Excel</b></a>

However, when I use sessions, it works. I don't know what could be wrong... I'm thinking it has to do with configuration settings somehow, but I don't know what...

- Jeff

Share this post

Link to post
Share on other sites
It could have to do with register globals.  If register globals is off in your config at work but on at your home site then that could be the problem.

Share this post

Link to post
Share on other sites
I always write my code as if globals are turned on.

If I'm needing to carry variables from one script to another then I send them one way or another whether it be via the URL or using forms. Any variables that I'm using fresh I make sure they're clear first or set to what they need to be set to.

That way when my code gets moved from server to server like a lot has done in the past I know it stands a much higher chance of working as I want it to.

Never presume globals are always on or off.

Share this post

Link to post
Share on other sites


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.