Have you tried naming your form elements such as skill[], sky[] and slu[] ? (You could also use skill[1], skill[2], skill[3] etc... within your form.) This would pass the form values as arrays which you can then iterate through in your script. $skills = $_POST['skill']; $skys = $_POST['sky']; $slus = $_POST['slu']; foreach($skills as $idx => $skill) { if ($skys[$idx]) { // Validate this sky element } if ($slus[$idx]) { // Validate this slu element } } You can just as easily store the arrays in your $_SESSION if the processing is to be done later. Note: Some form element types only pass a value if ticked/checked/selected. This will present problems if naming your form elements with [], instead use [x], [y] etc to keep all relevant form elements together in the same array indexes. (Am I making sense?, No?, time for bed then...) HTH Graham > -----Original Message----- > From: Stuart Felenstein [mailto:stuart4m@xxxxxxxxx] > Sent: 16 October 2004 22:48 > To: php-db@xxxxxxxxxxxxx > Subject: Question: Putting seperate form elements into an array > > > Right now this seems something like solving a rubic's > cube. While I process, I hope it's alright that i'm > asking here. I think my quantity of posts have been > high :) > > I have these form elements:(these are the names of the > elements) > > skill1 sky1 slu1 > skill2 sky2 slu2 > skill3 sky3 slu3 > ..... ... .... > > They are being passed as sessions variables: > > $_SESSION['f411a'] = $_POST['skill1']; > $_SESSION['f411b'] = $_POST['sky1']; > $_SESSION['f411c'] = $_POST['slu1']; > $_SESSION['f412a'] = $_POST['skill2']; > $_SESSION['f412b'] = $_POST['sky2']; > $_SESSION['f412c'] = $_POST['slu2']; > $_SESSION['f413a'] = $_POST['skill3']; > $_SESSION['f413b'] = $_POST['sky3']; > $_SESSION['f413c'] = $_POST['slu3']; > > Perhaps instead of listing them out I should find a > way here to get them into an array. > Also, none of these are required fields, but if the > user put something in for Skill1 , then they should > input for sky1 and slu1. > > Now I need to sort them out for processing into the > database. I don't think it's wise to check each one. > When they go into the database, each "skill, sky , > slu" > is a new record. > > +---------+----------+---------+--------+ > | Record | Skill | Years | Used | > +---------+----------+---------+--------+ > | 1001 | Skill1 | sky1 | slu1 | > +---------------------------------------+ > | 1002 | Skill2 | sky2 | slu2 | > +---------------------------------------+ > > Someone partially wrote something out for me. But I > can't quite understand it. > > for($i=0; $i<5; $i++){ > echo ('<br>-'.@$HTTP_SESSION_VARS['f41'.($i+1).'a']); > if (!empty($HTTP_SESSION_VARS['f41'.($i+1).'a'])){ > $_SESSION('skil', $_SESSION['f41'.($i+1).'a']); > $_SESSION('yrs', $_SESSION['f41'.($i+1).'b']); > $_SESSION('used', $_SESSION['f41'.($i+1).'c']); > > > I see the increment , though I'm not sure why there is > an echo at the start. f41 comes from nowhere and it > looks like each field has 2 variables. > > Anyway I am seriously trying the figure this out, > apologies for sending it to the list. > > Thank you, > Stuart > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php