User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 426,319 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,316 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

$_POST and arrays

Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation: Troy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 4
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

Re: $_POST and arrays

  #2  
Jul 4th, 2005
Originally Posted by paradox814
[php]$_SESSION['someVar'][$i] = $_POST['someVar'][$i][/php]
$_POST['someVar'][$i] is not valid unless your 'someVar' FORM element is an array of checkboxes or you have multiple text fields with the same name. Normally, it would just be $_POST['someVar'].

Whether it is an array or not, you can just do this:
[PHP]
$_SESSION['someVar'] = $_POST['someVar'];
[/PHP]It does not matter whether 'someVar' is an array or not--the session var will still receive the value.
Troy Wolf is the author of SnippetEdit. "Website editing as easy as it gets." IX Web Hosting
Reply With Quote  
All times are GMT -4. The time now is 10:50 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC