SunQuest
           PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old April 5th, 2004, 06:36 PM
aj2taylo aj2taylo is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Mississauga, ON, Canada
Posts: 61 aj2taylo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 sec
Reputation Power: 2
Send a message via ICQ to aj2taylo Send a message via AIM to aj2taylo Send a message via Yahoo to aj2taylo
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?

Reply With Quote
  #2  
Old April 5th, 2004, 07:34 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
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

Reply With Quote
  #3  
Old April 6th, 2004, 05:59 AM
Andrew's Avatar
Andrew Andrew is offline
Moderator
Click here for more information
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,937 Andrew User rank is Private First Class (20 - 50 Reputation Level)Andrew User rank is Private First Class (20 - 50 Reputation Level)  Folding Points: 2429 Folding Title: Novice Folder
Time spent in forums: 4 Days 1 h 57 m 37 sec
Reputation Power: 3
Orkut
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.

Reply With Quote
  #4  
Old April 6th, 2004, 11:45 AM
aj2taylo aj2taylo is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Mississauga, ON, Canada
Posts: 61 aj2taylo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 sec
Reputation Power: 2
Send a message via ICQ to aj2taylo Send a message via AIM to aj2taylo Send a message via Yahoo to aj2taylo
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


Reply With Quote
  #5  
Old April 6th, 2004, 12:04 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: PHP - passing variables

Just an FYI, if you use the extract() function at the top of each page like so,

php Code:
Original - php Code
  1.  
  2. <?
  3. extract($_GET);
  4. ?>


then you will be able to keep register_globals off and still refernce the variables as $myvar etc..etc..

Reply With Quote
  #6  
Old May 12th, 2004, 11:51 AM
Coetz Coetz is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Pretoria, Gauteng, South Africa
Posts: 9 Coetz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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"?

Reply With Quote
  #7  
Old May 12th, 2004, 02:07 PM
LordChris LordChris is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Arad, Romania
Posts: 46 LordChris User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to LordChris
RE: PHP - passing variables

Sessions... you need sessions ;)

Reply With Quote
  #8  
Old June 4th, 2004, 01:51 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
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

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > PHP - passing variables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway