Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing with Wildcards

Status
Not open for further replies.

BiJae

Programmer
Oct 1, 2002
154
US
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 . &quot;\,&quot;. $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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top