I am writing a program with 10 variables being put to the database, i.e. $off1, $off2, $off3,... $off10. Some of these may be array's from Multiple select in the form. I have found a way to solve this problem with the code,
if(is_array($off10)) include('Scripts/multiselect.php');
where 'Scripts/multiselect.php' ==
$select = count($off10);
for($i=0; $i < $select; $i++){
$y = $off10[$i];
if($i == 0) $x = $y;
if($i > 0) $x = $x . "\,". $y;
}
$off10 = $x;
My question is, if I have two (or more) multi-selects on my page, is there a way for me to substitute $off10 with $off* and have the script run for each variable that is an array? Or do I have to test and have a script for each instance that a variable is an array? Brian
if(is_array($off10)) include('Scripts/multiselect.php');
where 'Scripts/multiselect.php' ==
$select = count($off10);
for($i=0; $i < $select; $i++){
$y = $off10[$i];
if($i == 0) $x = $y;
if($i > 0) $x = $x . "\,". $y;
}
$off10 = $x;
My question is, if I have two (or more) multi-selects on my page, is there a way for me to substitute $off10 with $off* and have the script run for each variable that is an array? Or do I have to test and have a script for each instance that a variable is an array? Brian