Jump to content


Photo

Passing Variables w/ PHP 5.1.5


  • Please log in to reply
4 replies to this topic

#1 ibanez270dx

ibanez270dx
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 22 August 2006 - 05:46 PM

Hi,
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...

Thanks,
- Jeff

#2 Corona4456

Corona4456
  • Members
  • PipPipPip
  • Advanced Member
  • 244 posts
  • LocationEl Paso, TX

Posted 22 August 2006 - 05:56 PM

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.
What is the CoronaMatrix?

#3 ibanez270dx

ibanez270dx
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 22 August 2006 - 06:20 PM

It worked! Good call! Thanks!

#4 Corona4456

Corona4456
  • Members
  • PipPipPip
  • Advanced Member
  • 244 posts
  • LocationEl Paso, TX

Posted 22 August 2006 - 06:28 PM

Sweet! :D Your welcome!
What is the CoronaMatrix?

#5 Yesideez

Yesideez
  • Members
  • PipPipPip
  • Advanced Member
  • 2,334 posts
  • LocationDevon, UK

Posted 22 August 2006 - 06:34 PM

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.
Not a pro just an enthusiast :)

if (empty($coffee)) {$coffee=new coffee();}

Please surround any code using the CODE tags - I rarely look at anything without them




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users