aduvall

asked on

# How do I loop through a posted array?

I have an array I am POSTING from flex.

$pizza = $_POST['cust'];// the posted array(cusa, cusb, cusc, etc...)

$pieces = explode(",", $pizza);//this part seems fine.

I need to run this formula based on the posted data. At this time I am doing this.

$creport->RecordSelectionFormula = "{ar_invl.cust-no} in ['".$pieces[0]."','".$pieces[1]."','".$pieces[2]."','".$pieces[3]."','".$pieces[4]."','".$pieces[5]."'] and {ar_invl.inv-date} in Date (".$start.") to Date (".$end.")";

Isn't there some sort of loop I can contstruct so I do not need to keep adding vars to this formula?

I have tried this but it does not seem to work. I would like to solve this problem as I have had issues with this for some time. Any help appreciated.

for($i=0; $i<$pieces; $i++){

$creport->RecordSelectionFormula = "{ar_invl.cust-no} in ['".$pieces[$i]."'] and {ar_invl.inv-date} in Date (".$start.") to Date (".$end.")";

}

$pizza = $_POST['cust'];// the posted array(cusa, cusb, cusc, etc...)

$pieces = explode(",", $pizza);//this part seems fine.

I need to run this formula based on the posted data. At this time I am doing this.

$creport->RecordSelectionF

Isn't there some sort of loop I can contstruct so I do not need to keep adding vars to this formula?

I have tried this but it does not seem to work. I would like to solve this problem as I have had issues with this for some time. Any help appreciated.

for($i=0; $i<$pieces; $i++){

$creport->RecordSelectionF

}

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER

{ar_invl.cust-np} in ['SON","SONINTL","TOSHIBA"

On the second response I only get the last item in the array. Why would this be?