Believe it or not I had just thought of doing a foreach with the validation. I'll see how it goes. Stuart --- Graham Cossey <graham@xxxxxxxxxxxxxxx> wrote: > Maybe you would like to post your validation code > then. > > I (we) do not know where the line: > > (((isset($_POST["skill[]"]))?$_POST["skill[]"]:"")."",true,true,true,true,"" > ,false,1); > > is being called. > > Have you thought about using an iteration as you > have when constructing the > INSERT statement? > Have you considered placing validation within the > iteration you have when > constructing the INSERT statement? > > If you do a print_r($skills) you will see that > although in the form they are > named skill[] when passed to your script they will > be skill[0], skill[1], > skill[2]... > > Also, this line : > > foreach($_SESSION['skills'] as $key => $skill) > > could read > > foreach($skills as $key => $skill) > > as you have the line: > > $skills = $_SESSION['skills']; > > Same for skys and slus. > > Graham > > > -----Original Message----- > > From: Stuart Felenstein > [mailto:stuart4m@xxxxxxxxx] > > Sent: 20 October 2004 14:06 > > To: Graham Cossey; php-general@xxxxxxxxxxxxx > > Subject: RE: Validation problem with array. > > > > > > My problem is not related to the insert or > iteration. > > It's related to the validaton of those elements: > > skill[] > > skill[] > > etc. > > > > Clearer ? > > > > Stuart > > --- Graham Cossey <graham@xxxxxxxxxxxxxxx> wrote: > > > > > Not sure I really know where you have the > problem, > > > but I am assuming you are > > > trying to construct the INSERT statement within > your > > > foreach loop. > > > > > > If so, why use $_POST["skill[]"] when you have > > > $skill which is that current > > > element being iterated? > > > Did you read the foreach doc? > > > > > > http://uk2.php.net/manual/en/control-structures.foreach.php > > > > > > HTH > > > Graham > > > > > > > > > > -----Original Message----- > > > > From: Stuart Felenstein > > > [mailto:stuart4m@xxxxxxxxx] > > > > Sent: 20 October 2004 13:35 > > > > To: php-general@xxxxxxxxxxxxx > > > > Subject: Validation problem with array. > > > > > > > > > > > > After some back and forth posts here I had > finally > > > > thought my array issue was over, but! > > > > > > > > To review I have 30 form elements on a page > > > > 10 are skill[] > > > > 10 are sky[] > > > > 10 are slu[] > > > > > > > > I pass them as session variables > > > > > > > > $_SESSION['skills'] = $_POST['skill']; > > > > $_SESSION['skys'] = $_POST['sky']; > > > > $_SESSION['slus'] = $_POST['slu']; > > > > > > > > Then when everyting is passed into a database > > > > transaction: > > > > > > > > $skills = $_SESSION['skills']; > > > > $skys = $_SESSION['skys']; > > > > $slus = $_SESSION['slus']; > > > > > > > > foreach($_SESSION['skills'] as $key => $skill) > > > > { > > > > $query = "INSERT INTO Profiles_skills > (ProfileID, > > > > SkilCerts, NumYear, Lused) > > > > VALUES ($LID, '$skill', > > > > > > > > > > {$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]})"; > > > > //$result = mysql_query($query); > > > > > > > > Here is the problem: > > > > > > > > Using > > > > > (((isset($_POST["skill[]"]))?$_POST["skill[]"]:"") > > > . > > > > "",true,true,true,true,"",false,1); > > > > > > > > I can't seem to differentiate between the the > > > elements > > > > because they are all labeled skill[] > > > > So basically validation isn't doing anything . > > > > > > > > I'm thinking of finding a better way to > validate , > > > or > > > > if i change the elements to skill[1], skill[2] > , > > > what > > > > would that do to my iteration loop ? > > > > > > > > Thank you, > > > > Stuart > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: > > > http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php