Validation problem with array.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux