Stuart Felenstein wrote:
John,
Sorry, I'm not trying to be unclear. There are 3 columns in the table. In the user form. there are 30 fields, 10 text and 20 dropdown.
The 10 text are:
$_SESSION['skills'] = $_POST['skill']; The first dropdown is :
$_SESSION['skys'] = $_POST['sky']; The second dropdown is:
$_SESSION['slus'] = $_POST['slu'];
So I need to grab the input and
enter into database where each set of skill, sky , slu is a new record.
I hope this is clearer.
Did you read the answer I gave?
foreach($skills as $key => $skill) { echo "$skill - {$skys[$key]} - {$slus[$key]}\n"; }
Now adapt that to your session variables and query:
foreach($_SESSION['skills'] as $key => $skill)
{
$query = "INSERT INTO table (skill, sky, sku) VALUES ('$skill', {$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]})";
//run query
}
or, if you can use extended inserts:
$insert = array();
foreach($_SESSION['skills'] as $key => $skill)
{ $insert[] = "('$skill',{$_SESSION['skys'][$key]},{$_SESSION['skus'][$key]})";
}
$query = 'INSERT INTO table (skill,sky,sku) VALUES ' . implode(',',$insert);
//run query
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php