Page 2 of 2

Posted: Fri Jul 27, 2007 9:24 am
by jramaro
hey Jim , somethin to keep in mind is that when you use session_start()
it will pass Sesisons to the next page, but only if on the firts page, if those were set as a sessions

example $_SESSION['widget'] ;

but when you use a FORM that the user submits it isnt making them sessions yet. because they dont exist until user submits form.

Then , your second page has to read something like this:
Pretend one of the inputs was for the user to input their name on page one.
You couldnt use $_SESSION['name'] on page 1.
Because it wont exist when that page loads, not until user submits that form .

when it goes to page two . you want to have something to converted that POST data to a session
like this :

Code: Select all

$_SESSION['name'] = $_POST['name'];
your form on page one will have to be method="post" or "get" if you want to send it that way .
But on form submits and user input data , the Session cant exist until it is 1. submitted to next page. (becomes a $_POST variable)
2. you convert it to sessions.

its a simple thing like a roller skate laying on a stair , important to realize that the $_POST and $_SESSION tactics

Posted: Fri Jul 27, 2007 9:42 am
by superdezign
@jramaro: I'm fairly certain that he was already doing everything that you stated in your post.

Posted: Fri Jul 27, 2007 9:48 am
by jramaro
My bad..
its just that his post was SO frigign HUGE 8O

Posted: Fri Jul 27, 2007 10:42 am
by RobertGonzalez
Before we start diagnosing the problem (and making statements to the mental state of the poster) can we be sure that sessions are working?

@ Original Poster: Have you ran the session testing scripts yet? What are the results?

Posted: Fri Jul 27, 2007 12:19 pm
by jramaro
why?! ...

did somebody call me crazy!? ...

(looks around wildly)

Posted: Fri Jul 27, 2007 12:54 pm
by jimdavidson
Problem solved.

For the header I had this...
header('Location: http://bobtracyinsurance.com/btracy_auto_quotes_2.php');

What I should have had was this...
header('Location: http://www.bobtracyinsurance.com/btracy ... otes_2.php');

Three little w's made the difference, session variables now work.

I'll get better, one thing going for me is that I keep trying.

Posted: Fri Jul 27, 2007 1:12 pm
by RobertGonzalez
That means that there is something screwey with your session cookie domain. If the domain is akin to 'domain.com' then you should change that to '.domain.com' and it will work for any subdomain of your domain, including 'www'.

Posted: Fri Jul 27, 2007 1:27 pm
by jimdavidson
Thanks, that's something else for me to learn.

Life was so much easier in the old days of DOS.

Posted: Fri Jul 27, 2007 1:38 pm
by jimdavidson
session cookie domain?

I assume that I find that by running phpinfo()?

I did and the results from the server say...

session.cookie_domain Local value = (no value) and Master value = (no value).

Is this correct or do I need to have the web host put some value in there?

Posted: Fri Jul 27, 2007 3:50 pm
by RobertGonzalez
That should do for the most part, at least according to the manual. Though I know that the domain 'domain.com' may not include the domains in '.domain.com'.