Validation problem with array.

From: Date: Wed, 20 Oct 2004 12:35:06 +0000
Subject: Validation problem with array.
Groups: php.general 
Request: Send a blank email to php-general+get-199871@lists.php.net to get a copy of this message
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

« previous php.general (#199871) next »