|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
PHP - passing variables
Hello,
The server is using php 4.3.5 version, and I'm having some difficulty passing variables. When I pass a variable through an URL (eg. http://www.mydomain.com/page.php?number=5), the value of $number on page.php isn't 5. Instead, I have to use $_GET['number']. In using the same script elsewhere, $number is 5 automatically. Is there setting I have to set in the php.ini file for this to work for me? |
|
#2
|
|||
|
|||
|
RE: PHP - passing variables
The setting is register_globals and is set to off by default in php. Change it to on and you should be good to go. FYI, here is a link to the documentation on register_globals.
http://us2.php.net/register_globals |
|
#3
|
||||
|
||||
|
RE: PHP - passing variables
there are other ways you can simply put $varname=$_GET['varname'];
if you dont want to perminantly change it. Either way works. |
|
#4
|
|||
|
|||
|
RE: PHP - passing variables
Thanks guys, it's cool now. The register_globals was the solution. I wanted to avoid the $_GET method, since it would involve fixing all the pages in the site.
AT |
|
#5
|
|||
|
|||
|
RE: PHP - passing variables
Just an FYI, if you use the extract() function at the top of each page like so,
then you will be able to keep register_globals off and still refernce the variables as $myvar etc..etc.. |
|
#6
|
|||
|
|||
|
RE: PHP - passing variables
I have about the same problem as above.
My Problem = Passing var from one php page to another, I have a variable EX. $name = Sam; that I got from an input on page 1 and I passed it to page 2($NAME = $_POST['name']), then I have a new variable EX $date = 2004/05/12; that I got from an input on page 2, now I want to send both variables ($date & $NAME) to page 3 but only $date is send to page 3 and not $NAME. So how can I send a variable from one page to another "THAT I DID NOT GET FROM SOME SORT OF INPUT"? |
|
#7
|
|||
|
|||
|
RE: PHP - passing variables
Sessions... you need sessions ;)
|
|
#8
|
|||
|
|||
|
RE: PHP - passing variables
Thanks for the tip BlindEddie
but the link is dead at this time. can you redirect me? Daryn ------------------------------- The setting is register_globals and is set to off by default in php. Change it to on and you should be good to go. FYI, here is a link to the documentation on register_globals. http://us2.php.net/register_globals |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Installation > PHP - passing variables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|