Solved

Pass Variables in PHP

Posted on 2014-11-30
9
229 Views
Last Modified: 2014-11-30
After I moved my website from Windows 2003 to 201R2 server I can no longer pass php variables as before.

Before I could do http://web.dot?variable=text
In php, echo "$variable"

But on the new server I need to do echo $_get['variable'] and it does not always work.
0
Comment
Question by:soffcec
9 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40472854
Just doing

echo "$variable"

would never have worked

You need to use $_GET['variable_name']

Notice the case is uppercase.
0
 

Author Comment

by:soffcec
ID: 40472860
But on the older server I only did need to do echo "$variable" and have done so for years and can still do on the older server. I will need to rewrite all my stuff if this is not going to work.
Following code gives the same result on the old server but only $_GET works on the new one.
<?
echo "$br";
echo $_GET['br'];
?>
0
 
LVL 58

Expert Comment

by:Gary
ID: 40472864
What PHP version is running on the old server? First time I've come across this!
0
 

Author Comment

by:soffcec
ID: 40472869
They have the sam version PHP Version 5.3.28


http://o.tsc.is/php.php
http://n.tsc.is/php.php
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 34

Accepted Solution

by:
Dan Craciun earned 300 total points
ID: 40472876
You had "register_globals" set to on/enabled on the old server. This is a serious security risk so on modern versions of PHP this is disabled by default.

Look for register_globals in php.ini and see if you can enable it. I would advise against it.

LE: you can see the difference in the php info pages from your links. On one server register_globals is on, on the other it's off.

HTH,
Dan
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 200 total points
ID: 40472882
@Dan - Good catch
modern versions of PHP this is disabled by default
Completely removed.
0
 

Author Comment

by:soffcec
ID: 40472884
Yes , was just reading. I will consider this, but I have been running register_globals = on since 2003, and never had problem, but maybe I will have one tomorrow. We never know.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40472915
If you read the link that Gary provided, you won't have a problem 'tomorrow' because starting in PHP 5.4, there will not be any 'register_globals'.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 40472933
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Resolve DNS query failed errors for Exchange
This article discusses four methods for overlaying images in a container on a web page
In this Micro Tutorial viewers will learn how to restore their server from Bare Metal Backup image created with Windows Server Backup feature. As an example Windows 2012R2 is used.
The viewer will learn how to count occurrences of each item in an array.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now