Weird $_POST behavior when trying to unset elements



[PHP]
// NEW 11/27/2006: FINALLY, IF YOU ADDED OR DELETED OR DID ANY KIND OF
FORM ACTION SUCCESSFULLY, DON'T RE-DISPLAY THE NEW EXPENSE ITEMS VIA
$_POST
if ($_POST['hasUpdatedLease'] && (!is_array($leaseObj->errorArray) ||
@sizeof($leaseObj->errorArray) == 0)) {
print_r(array_keys($_POST));
@reset($_POST);
$tempPost = $_POST;
foreach ($_POST as $key => $val) if (strpos($key, 'new_') === 0)
array_remove($tempPost, $tempPost[$key]);
@reset($_POST);
$_POST =& $tempPost;
print_r(array_keys($_POST));
}
[/PHP]

For some reason, even though the condition is always met when I click
any of the form submit images, the following "weird behavior patterns"
occur:

1) If I click the "Add" submit image, all $_POST values whose keys
start with "new_" should be removed from $_POST. However,
$_POST['new_audited'] and $_POST['new_reoccuring'] remain

2) If I click the "Delete" submit image, all $_POST values whose keys
start with "new_" should be removed from $_POST. However, *ALL* of
them remain in $_POST untouched!

I can verify that I enter the conditional block by my arrays appearing
on screen every time.

Any reason why this is happening that I missed?

Thanx
Phil

.



Relevant Pages

  • Re: Weird $_POST behavior when trying to unset elements
    ... DON'T RE-DISPLAY THE NEW EXPENSE ITEMS VIA ... If I click the "Delete" submit image, all $_POST values whose keys ... Any reason why this is happening that I missed? ... Remove a specific element from the array. ...
    (comp.lang.php)
  • Re: Weird $_POST behavior when trying to unset elements
    ... DON'T RE-DISPLAY THE NEW EXPENSE ITEMS VIA ... If I click the "Delete" submit image, all $_POST values whose keys ... Any reason why this is happening that I missed? ...
    (comp.lang.php)
  • Re: Car stolen? Youre on the hook for the damage the thief does.
    ... wouldn't leave a car with the keys in the ignition. ... For at least the first 25 years of my life, reasonable people left keys ... vehicles with the keys in the ignition during the lunch hour. ... My contention is that cars are equipped with keys for the same reason homes ...
    (rec.autos.driving)
  • Re: HP 48GX ON key problem
    ... The reason would be in yur case that the main board is not making ... I tried your suggestion of pressing ... above the B and C keys and using the on/off button. ... but maybe its better than opening ...
    (comp.sys.hp48)
  • Re: HP 48GX ON key problem
    ... Edwin Mendoza wrote: ... The reason would be in yur case that the main board is not making ... I tried your suggestion of pressing ... above the B and C keys and using the on/off button. ...
    (comp.sys.hp48)