General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 9th, 2004, 01:41 PM
salvelinus salvelinus is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 24 salvelinus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
$HTTP_POST_VARS losing values

Yes, I know I should use $_POST, but I didn't write the program, just modifying it some.
I have a functions.php file that includes a function to set starting and ending dates. These values are then put into $HTTP_POST_VARS.
When I run a print_r($HTTP_POST_VARS) right after setting the values, they print out correctly. But when I run a print_r on the next page, a different php file, they're gone (although others are there).
Why aren't they being sent to the next page? Thanks.
Oh, and register_globals is turned on.
PHP Code:
//this prints out
else
    {
        
$HTTP_POST_VARS['startdate-month'] = (date("m",mktime(000112000)));
        
$HTTP_POST_VARS['startdate-date'] = (date("d",mktime(000112000)));
        
$HTTP_POST_VARS['startdate-year'] = (date("Y",mktime(000112000)));
        
$today getdate();
        
$HTTP_POST_VARS['enddate-month'] = (date("m"mktime(000$today["mon"], $today["mday"], $today["year"])));
                
$HTTP_POST_VARS['enddate-date'] = (date("d"mktime(000$today["mon"], $today["mday"], $today["year"])));
        
$HTTP_POST_VARS['enddate-year'] = (date("Y"mktime(000$today["mon"], $today["mday"], $today["year"])));
        
print_r ($HTTP_POST_VARS);
    }
/* prints Array ( [user] => sample [pass] => [tablename] => sample [client] => N [startdate-month] => 01 [startdate-date] => 01 [startdate-year] => 2000 [enddate-month] => 03 [enddate-date] => 09 [enddate-year] => 2004 ) */
/* print_r on next page prints Array ( [categoryid] => All Patients [survey_question] => 9 [getcomments] => Get Comments [patcomments] => [user] => SAMPLE [pass] => [sessid] => 10 [tablename] => sample ) 
*/ 

Reply With Quote
  #2  
Old March 9th, 2004, 03:17 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via ICQ to dhouston
Is the second page included or is it called through a separate request? If it's a separate request, there's your problem -- post vars aren't persistent; they're valid only for a given request.
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #3  
Old March 9th, 2004, 04:44 PM
salvelinus salvelinus is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 24 salvelinus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hmm...
Ok, the first page is an html login page. This takes the user to index.php, which includes the file functions.php (which are just a group of functions).
index.php calls one of the functions, say funcA, in functions.php, which then calls other functions in the same file. One of these set up several select boxes to pick dates. But for one category of client, I don't want to show the select boxes, even though I need default date values. So I decided that for that category of client, I'd just skip the function that allowed date selection and give default values (these are the post variables).
funcA calls form action="report.php" method="POST, then either calls the date function or I give it default values.
Other functions are called from report.php, which also href to some other .php files.
It works if I set the post variables in report.php, which I can understand, but how do the post variables normally get set from the date selection function? They're the same post variables.
When I set the post vars in funcA, they don't get transferred to report.php or at least to the other .php files. So how does the select box function make them available? It just creates and populates them.
This would be a lot easier in VB. One annoying/confusing element is these are mostly all php files that also create the html, rather than php embeded in html.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > $HTTP_POST_VARS losing values


Developer Shed Advertisers and Affiliates


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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap