RE: [PHP] Nested foreach ?
| From: | Graham Cossey | Date: | Mon, 18 Oct 2004 08:57:15 +0000 |
| Subject: | RE: [PHP] Nested foreach ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199709@lists.php.net to get a copy of this message | ||
These lines store the FORM's posted values (arrays)
into your SESSION:
$_SESSION['skills'] = $_POST['skill'];
$_SESSION['skys'] = $_POST['sky'];
$_SESSION['slus'] = $_POST['slu'];
These lines get your SESSION variables (arrays) and
put them into 'local' script array variables.
If you are doing these then you MUST have done the above
in the previous script.
$skills = $_SESSION['skills'];
$skys = $_SESSION['skys'];
$slus = $_SESSION['slus'];
If you are doing it all in one script just use:
$skills = $_POST['skills'];
$skys = $_POST['skys'];
$slus = $_POST['slus'];
Make sense?
If not, may I suggest you do a bit of reading on
PHP and form processing before proceeding.
I have found the PHP manual extremely useful.
With it (and some googling) I have gone from zero
PHP knowledge 10 months ago to being able to
develop and maintain an entire PHP/MySQL based
web application subscribed to by several clients.
HTH
Graham
> -----Original Message-----
> From: Stuart Felenstein [mailto:stuart4m@yahoo.com]
> Sent: 18 October 2004 09:37
> To: Graham Cossey; php-general@lists.php.net
> Subject: RE: [PHP] Nested foreach ?
>
>
> Wish I had better news.
>
> Warning: Invalid argument supplied for foreach() in
> /home/lurkkcom/public_html/TestMultiTrans2.php on line
> 90
> INSERT INTO LurkProfiles_Skicerts (ProfileID,
> SkilCerts, NumYear, Lused) VALUES ()
>
>
> line 90: foreach($skills as $key => $skill)
>
> To confirm :
>
> I changed to this:
> > // Doing this makes the code below easier to read
> > $skills = $_SESSION['skills'];
> > $skys = $_SESSION['skys'];
> > $slus = $_SESSION['slus'];
>
> From this :
> I changed the $_SESSION['skills'] = $_POST['skill'];
> $_SESSION['skys'] = $_POST['sky'];
> $_SESSION['slus'] = $_POST['slu'];
>