tgrk35
06-25-2007, 11:37 AM
Ok, here's my script:
$bpcaccounts = array();
for($i = 0; $i < count($_POST['bpc']); $i++){
if($_POST['bpc'][$i]['bpcname'] != '' && $_POST['bpc'][$i]['bpcnum'] != '' && $_POST['bpc'][$i]['bpcexp'] != ''){
$bpcaccounts .= array('bpcname' => $_POST['bpc'][$i]['bpcname'],'bpcnum' => $_POST['bpc'][$i]['bpcnum'],'bpcexp' => $_POST['bpc'][$i]['bpcexp']);
}
}
Basically...it's messed up. I just want to pull the values from $_POST['bpc'] that aren't blank. $_POST['bpc'] is a 2d array (basically). I can get it to pull only the ones I want (the ones that aren't blank), but then I try to put it in a new array ($bpcaccounts) and it messes up. If I do a print_r on $bpcaccounts, I get this:
ArrayArrayArray
Anyway, I know the problem probably lies in my creation of the $bpcaccounts array.
Does anyone have any ideas? I'm VERY confused and I've been working on this for nearly 2 weeks now...which is sad, honestly.
Anyway, all help I can get is much appreciated.
Thanks :)
Will
$bpcaccounts = array();
for($i = 0; $i < count($_POST['bpc']); $i++){
if($_POST['bpc'][$i]['bpcname'] != '' && $_POST['bpc'][$i]['bpcnum'] != '' && $_POST['bpc'][$i]['bpcexp'] != ''){
$bpcaccounts .= array('bpcname' => $_POST['bpc'][$i]['bpcname'],'bpcnum' => $_POST['bpc'][$i]['bpcnum'],'bpcexp' => $_POST['bpc'][$i]['bpcexp']);
}
}
Basically...it's messed up. I just want to pull the values from $_POST['bpc'] that aren't blank. $_POST['bpc'] is a 2d array (basically). I can get it to pull only the ones I want (the ones that aren't blank), but then I try to put it in a new array ($bpcaccounts) and it messes up. If I do a print_r on $bpcaccounts, I get this:
ArrayArrayArray
Anyway, I know the problem probably lies in my creation of the $bpcaccounts array.
Does anyone have any ideas? I'm VERY confused and I've been working on this for nearly 2 weeks now...which is sad, honestly.
Anyway, all help I can get is much appreciated.
Thanks :)
Will