Have I learned nothing .> Foreach()
| From: | Stuart Felenstein | Date: | Tue, 30 Nov 2004 11:49:32 +0000 |
| Subject: | Have I learned nothing .> Foreach() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-203122@lists.php.net to get a copy of this message | ||
I thought this one was under my control. Apparently
not.
I'm getting a "Warning: Invalid argument supplied for
foreach() in /home/mysite/public_html/mypage.php on
line 143
First, I have 3 form elements
school[]
school[]
school[]
Here is how I initialize the session variable (after
user it's submit):
$_SESSION['schools'] = $_POST['school'];
Then finally on the transaction page, some pages down
the road:
foreach($_SESSION['schools'] as $school)
{
$query = "INSERT INTO mytable (ProfileID, School)
VALUES ($LID, '$school')";
$res6 = run_query($query);
}
I can't for the life of me find the issue here.
Any pointers / help would be greatly appreciated.
Stuart