Link to home
Start Free TrialLog in
Avatar of sargento
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?
Avatar of Batalf
Batalf
Flag of United States of America image

Duplicate! Delete this question
Avatar of sargento
sargento

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
Avatar of Hamlet081299
Hamlet081299

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial