Posted by J.O. Aho on 04/01/06 07:58
Chris H wrote:
> I have been looking through this script and came across something that I
> dont quite understand how it functions or is used. Basically its brackets
> that are added on at the end of a form field value.
>
> EXAMPLE:
> <input name="eid[]" type="hidden" id="eid[]" value="<? echo $ses_id; ?>">
Instead of sending variables you send arrays, this is specially good if you
have a list where you can select more than one option.
Arrays can be easier to handle as you can loop through them and preform a task
on them all, while using single variables, you will need to it "manually" for
each.
for($i=0;$i<count($array);$i++) {
$array[$i]=fix($array[$i]);
}
vs
$variable0=fix($variable0);
$variable1=fix($variable1);
$variable2=fix($variable2);
$variable3=fix($variable3);
$variable4=fix($variable4);
$variable5=fix($variable5);
$variable6=fix($variable6);
$variable7=fix($variable7);
$variable8=fix($variable8);
$variable9=fix($variable9);
$variable10=fix($variable10);
$variable11=fix($variable11);
$variable12=fix($variable12);
But the code will be easier to follow if you use single variables (if you name
them properly).
//Aho
[Back to original message]
|