I have a series of selects that contain world regions.
For instance select r0 would contain
Africa
North America
Europe
When the user selects North America, a new select named r1 would appear with the following values:
Canada
United States
Mexico
Then the user would select US, r2 would appear with the states and so on.
As the data structure allows, currently, there can be up to 5 boxes (r0-r4)
I am trying to figure out how in php I can determine that there are 4 or 5 selects, and save that value of the highest number select to the database.
Am I going at this the wrong way?
Currently, I don't have any code written, because I'm not sure how to test the range of the $_POST["r#"] arrays, but was thinking something along the lines of:
<?php
$i = 0;
while (isset($_POST['r'.$i])) {
$highest_value = $_POST['r'.$i];
$i++;
}
?>
is there a better way?