I have a dynamic list of products generated for clients on my site. THere are two items too check/fill out
a.)A checkbox too determine if they want too have that product
b.)A text box too enter the qty they want of that product
The problem when the values get passed too the next page of course the QTY array has some empty values in it for the boxes that no values were entered in...sine not all items are selected
Now the option too add more products is available...I change the Arrays into a comma seperated text string via IMPLODE then pass that value too the product list page again.
Then I select more products if required, and go forward again and explode the STRING back too an ARRAY and merge the ARRAY created on the previous page with the other one...
Basically what I want too know is the best way too cycle through an array and delete any elements that are empty.
What happens is this...
The ITEMS array has say 3 products of the 6 selected b/c they were checked off.
But the QTY array has all 6 elements b/c the value of the text field is qty[] but only 3 of the elements are filled corresponding too the 3 items selected.
How can I remove all the empty elements from the QTY array so that both the QTY and ITEM arrays have 3 values each (for example) and delete all the other elements...
I've been using these too do it
UNSET()
and the array reindex function!! This has been messing me up for a while with this!! HELP!!