Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Pass Variables in PHP

Posted on 2014-11-30
9
Medium Priority
?
243 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 1200 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 800 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 84

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 111

Expert Comment

by:Ray Paseur
ID: 40472933
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

The following article is comprised of the pearls we have garnered deploying virtualization solutions since Virtual Server 2005 and subsequent 2008 RTM+ Hyper-V in standalone and clustered environments.
A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
Suggested Courses

926 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