Re-Using an Array (for strings of varying lengths)
Is there a way to re-set an array to null so I can use it multiple times for processing strings of varying lengths on the same page?
I have a 3-page form and am storing the name-value pairs from each page in a cookie.
On the 4th page, I print the name-value pairs from the 3 pages of my form, one page at a time -- I do this by calling a function 3 times & I want to use the same array 3 times.
The 1st page had 8 fields & I printed them out fine using the array.
The 2nd page had 12 fields & I printed them with no problem -- the array size simply expanded.
However, the 3rd page had 11 fields (1 field fewer than the page before it) & when I printed out the 11 3rd page values, it also printed the 12th value left over in the array from my previous page.
How can I "empty out" the array or re-set the array length to zero each time I use it?
|