Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
From a web form, I have the following array $_POST['locationKey']. The array positions range from 1 to 90,000 (and are out of order), but not every value in between is represented. For instance:Code: Select all
$_POST['locationKey'][1] = somevalue
$_POST['locationKey'][3] = somevalue
$_POST['locationKey'][90000] = somevalue
etc
$_POST['locationKey'][14] = somevalueI would then like to loop through the array, inserting data wherever the array position exists. Once I get the above value, would the following work correctly using array_key_exists?
Code: Select all
$maximumvalue = max($_POST['locationKey']);
for ($i = 0; $i <= MAXIMUMVALUE; ++$i) {
if (array_key_exists($i, $_POST['locationKey'])) {
//INSERT
}
}feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]