sargento
asked on
eval() on indexed value
I have a form that submits multiple hidden fields. Part of this form submits a field called $Orderline1 (40 total - $Orderline1 - $Orderline401). I'm trying to determine how many fields have data but I keep getting errors with my eval!
I have tried:
$cnt = 1;
$orders = 1;
while ($orders){
eval("if($OrderLine"+$cnt+ " != '')"){
echo $cnt;
}else{ $orders = 0;}
$cnt++;
}
////////////////////////// ////////// ////////// ////
I have also tried the eval line as:
if(eval("$OrderLine"+$cnt) != ""){
But I can't get the eval to work! Is this the best way to figure out how many fields have data and if so what is the eval statement. If not then what is the best way?
I have tried:
$cnt = 1;
$orders = 1;
while ($orders){
eval("if($OrderLine"+$cnt+
echo $cnt;
}else{ $orders = 0;}
$cnt++;
}
//////////////////////////
I have also tried the eval line as:
if(eval("$OrderLine"+$cnt)
But I can't get the eval to work! Is this the best way to figure out how many fields have data and if so what is the eval statement. If not then what is the best way?
Duplicate! Delete this question
ASKER
Duplicated question 3 time?
3 equals question. I have made a suggestion on how to solve your problem in one of them. The other ones should be deleted.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.