You are here: Re: How do I set Session Variables « PHP Programming Language « IT news, forums, messages
Re: How do I set Session Variables

Posted by Jerry Stuckle on 08/22/06 16:05

christopher.j.just@gmail.com wrote:
>
> flamer die.spam@hotmail.com wrote:
>
>>christopher.j.just@gmail.com wrote:
>>
>>
>>>I need to set the information being passed through the fields (23 of
>>>them) in the form into a session.
>>>
>>>Where do I start?
>>>
>>>Thanks,
>>>Chris
>>
>>you want the submitted data from a form into a session?
>>
>>//get the var out of the form
>>$var1 = $_POST["var1"];
>>
>>//stick it into session
>>$_SESSION["var2"] = $var1;
>>
>>Flamer.
>
>
> I was using this which I believe accomplishes the same thing:
>
> session_start();
> $_SESSION['firstname'] = $_POST['firstname'];
>
> now, if I understand correctly, the element from the _POST array should
> have set the variable in the _SESSION array.
>
> So how the heck do I retrieve it on subsiquent pages? And what sort of
> settings do you need in PHP.INI for sessions to work?
>
> I've got a ton of inherited code/programs that are using global
> variables=on and I've got to turn that off as soon as I can and I'm
> starting at a dead stop at the moment.
>
> Any help is appreciated.
>
> Chris

(Top posting fixed)

It's just as easy to get them out of the session:

session_start();
$firstname = $_SESSION['firstname'];

The default settings in the php.ini file often work fine. Just look at
the session entries. It's pretty well documented.

The biggest problem I've seen is the session.save_path must point to a
directory where the web server (if you're not using the CGI version of
PHP) must have read/write access.

P.S. Please don't top post. Thanks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация