|
-
Jul 18th, 2002, 04:10 PM
#1
Thread Starter
Lively Member
Variable Problem
This is my problem.
I have a url like this: test.php?myVar=Test
---- test.php -----
...
echo "$myVar";
...
----------------------
That should print out Test. But it does not.
I can not get any of my variables pasted in from a url to work.
I think there might some kind of php config file I need to mess with but I don't know what it would be. This is probably an older php 4 version on a windows box, running apache for windows...
If anyone knows what might be going on here I would appriciate the help.
Thanx,
Brandito
ps: I posted this q a few dayz ago but it must have been deleted or something 'cause I can't find it.
Master of Cyber Fu - A Temple of Digital Chi
-
Jul 18th, 2002, 05:38 PM
#2
Hyperactive Member
Try using
echo $_GET['myVar'];
alternativly, if you want the variable from forms, querystring, etc to be read into php variables, go to the php.ini file and change the register_globals.
Hope this helps.
(if it is coming from a form post, you can use $_POST['myVar'])
the standard is to have register_globals off and use the global arrays to retrieve your data.
-
Jul 25th, 2002, 01:25 PM
#3
Thread Starter
Lively Member
Thanx
Thanx allot!
That is probably exactly what I am looking for.
Master of Cyber Fu - A Temple of Digital Chi
-
Jul 28th, 2002, 07:51 PM
#4
Stuck in the 80s
Also, if you have information that could be coming from POST or GET, you can use $_REQUEST, which holds both POST, GET and a handfull of others.
As of PHP 4.2, register_globals is off by default, and it is now the "standard" method to use the superglobals.
-
Jul 28th, 2002, 10:33 PM
#5
Fanatic Member
It is much easier to have "register_globals" set to on but is realllly not a good practice. i have just started using global methods now and it makes things a bit easier t understand when going through your code 
As of PHP 4.2, register_globals is off by default[/B]
pissed me off to start with
-
Jul 28th, 2002, 10:51 PM
#6
Stuck in the 80s
They set it to off for security reasons, so I'm pretty sure it wasn't just flipping a coin that decided it.
And it's also not much harder to type $_REQUEST['name']; than $name; Programmers are just too lazy these days.
-
Jul 29th, 2002, 01:59 AM
#7
Fanatic Member
Originally posted by The Hobo
And it's also not much harder to type $_REQUEST['name']; than $name; Programmers are just too lazy these days.
I'm lazy, thats why i'm trying to get out of the habbit now and do things properly
-
Jul 29th, 2002, 11:28 AM
#8
Stuck in the 80s
I'm starting to be a hypocrit. *cleans up the pop cans all over his desk from the last month*
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|