Solved

Pass Variables in PHP

Posted on 2014-11-30
9
239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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
 
LVL 35

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 83

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 110

Expert Comment

by:Ray Paseur
ID: 40472933
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…

734 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