Reply
Loosing sesssion variable value
Old 03-27-2006, 06:47 AM Loosing sesssion variable value
numbenator's Avatar
Ultra Talker

Posts: 411
Location: London
Hi

I have a page that deals with a couple of forms and so there a a few requests that call the same page and out put results accorrdingly.

When the page is called , i run the below script at top of email.php

Code:
 if (!isset($_SESSION['callname'])) {       /* so if session varibale not exist */  /* this seems to be always being true where as it should be false after i have set it */
   session_start();                                                                              
   $_SESSION['callname'] = $_SERVER['HTTP_REFERER'];
 }
My problem is $_SESSION['compNumber'] is set correctly the first time email.php however, as email.php is a form, when the submit button is hit, email.php is re requested and $_SESSION['compNumber'] is reset to be email.php and NOT the calling page i wanted to keep a record of.

could someone please help with this lol. So frustrating

steve
__________________
www.mastech-solutions.com

Last edited by numbenator : 03-27-2006 at 06:49 AM.
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
When You Register, These Ads Go Away!
Old 03-27-2006, 08:38 AM Re: Loosing sesssion variable value
Super Spam Talker

Posts: 882
hi there,

why not put a hidden field in your form ... and then in that code you pasted above, just wrap another if statement around it .. so it would be .. if form hidden field not present .. go session fill, else don't bother.

ya know ?
Sir P is offline
Reply With Quote
View Public Profile
 
Old 03-27-2006, 09:34 AM Re: Loosing sesssion variable value
numbenator's Avatar
Ultra Talker

Posts: 411
Location: London
ok
2 ?'s

When you say don't bother do you mean that session variables can not be maintained easilly across pages?

secondly,

I tried on another page to use a hidden field but got zammed cause the form is output using print

So , how do i pass a value in to a hidden field thats output using the print command

code goes

Code:
print '<form action="#">
                   <input type="hidden" name="compI" value="$varName">'
$varName always comes out as $varName and not the value it contains.

Any help would be appreciated.
__________________
www.mastech-solutions.com
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Old 03-27-2006, 09:41 AM Re: Loosing sesssion variable value
capetek's Avatar
Extreme Talker

Posts: 229
Location: Massachusetts
Try '.$varName.' should work
__________________
Anthony LeBoeuf
Cape-Tek IT Solutions
www.cape-tek.com
Great hosting at affordable pricing!
capetek is offline
Reply With Quote
View Public Profile Visit capetek's homepage!
 
Old 03-27-2006, 09:45 AM Re: Loosing sesssion variable value
Super Spam Talker

Posts: 882
hi,

when I said dont bother.. I was talking as the code.. the code should not bother to assign (reset) the session var if the hidden value is there.

Second thing, the reason your only getting $varName printed to page is becuase that is the value, not the name.. you have ..
Quote:
<input type="hidden" name="compI" value="$varName">'
you should be printing $compI to the page ... right now $varName is the value.. as it is in the value tag
Sir P is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Loosing sesssion variable value
 

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12041 seconds with 12 queries