prateems32
New Member
- Messages
- 14
- Reaction score
- 0
- Points
- 1
I'm having a problem with the following code:
Now, I'm trying to migrate web-hosts from a different host to x10hosting, but I need to be able to run this kind of script. x10hosting has better features offered, so I definitely want to stick to it. On my prior web-host, this script works perfectly fine with no reported errors, but upon uploading of the exact same file to this server, I run into the following problem:
On loading the page (index.php), it executes the else part of the if() statement, but when I click on the link, it does not work as it should. It keeps taking me to the correct page (index.php?var=yes), where $var is defined, but continues running the else part of the if() statement.
This is a big issue for me because my script uses a bunch of these kinds of statements.
Any help would be appreciated. Thanks!
- Prateem Shrestha
---------- Post added at 05:22 AM ---------- Previous post was at 05:10 AM ----------
Based on the related threads links, it's probably because register_globals is turned off...
I'll try using $_GET['var'] in a temporary version of my script to see if it works and update accordingly. Cheers
---------- Post added at 05:28 AM ---------- Previous post was at 05:22 AM ----------
Yep, using $_GET['var'] worked perfectly fine.
Now I know.
PHP:
<?php # Script - index.php
if (isset($var)) {
// Check to see if the variable $var is given a value...
/* ... */ # <-- Bunch of PHP code to be executed if condition is met.
} else {
// If $var hasn't been defined...
echo "<a href=\"index.php?var=yes\">Set variable var=\"Yes\"</a>";
}
?>
Now, I'm trying to migrate web-hosts from a different host to x10hosting, but I need to be able to run this kind of script. x10hosting has better features offered, so I definitely want to stick to it. On my prior web-host, this script works perfectly fine with no reported errors, but upon uploading of the exact same file to this server, I run into the following problem:
On loading the page (index.php), it executes the else part of the if() statement, but when I click on the link, it does not work as it should. It keeps taking me to the correct page (index.php?var=yes), where $var is defined, but continues running the else part of the if() statement.
This is a big issue for me because my script uses a bunch of these kinds of statements.
Any help would be appreciated. Thanks!
- Prateem Shrestha
---------- Post added at 05:22 AM ---------- Previous post was at 05:10 AM ----------
Based on the related threads links, it's probably because register_globals is turned off...
I'll try using $_GET['var'] in a temporary version of my script to see if it works and update accordingly. Cheers
---------- Post added at 05:28 AM ---------- Previous post was at 05:22 AM ----------
Yep, using $_GET['var'] worked perfectly fine.
Now I know.
Last edited: