amites Posted January 30, 2009 Share Posted January 30, 2009 Hello, I'm running into a strange one, I have a form item that looks like: <input type="text" name="property_taxes_monthly_expenses[]" id="property_taxes_monthly_expenses" class="expense expenses money form_fields" tabindex="1" value="" style="width: 120px;"/> generated by: <td> $ <input type="text" style="width: 120px;" value="<?php if(isset($_POST['property_taxes_monthly_expenses[]'])) echo $_POST['property_taxes_monthly_expenses[]']; ?>" tabindex="1" class="expense expenses money form_fields" id="property_taxes_monthly_expenses<?php if($num > 0) echo $num;?>" name="property_taxes_monthly_expenses[]"/></td> the bug: the value placed into this form field is not being accepted, I've gone so far as to submit the value manually through a firefox extension, nada this form has over 100 fields and this is 1 of 2 that don't hold their value when I print_r($_POST) this is being built inside the code igniter framework though I have checked the $_POST var before anything is initiated and it comes back blank every time, if I rename the vars it works some of the time, setup the same way as 16 other array vars and I'm stumped any ideas? Link to comment https://forums.phpfreaks.com/topic/143081-solved-disappearing-_post-vars-from-array/ Share on other sites More sharing options...
ialsoagree Posted January 30, 2009 Share Posted January 30, 2009 I think this is your problem, you have: <?php if(isset($_POST['property_taxes_monthly_expenses[]'])) echo $_POST['property_taxes_monthly_expenses[]']; ?> You need: <?php // I'm guessing at indexes - assuming that you only have 1 HTML // input named "property_taxes_monthly_expenses[]" if(isset($_POST['property_taxes_monthly_expenses'][0])) echo $_POST['property_taxes_monthly_expenses'][0]; ?> If you don't want to deal with a multidimensional array than just change the HTML input's name to "property_taxes_monthly_expenses" without the brackets. Link to comment https://forums.phpfreaks.com/topic/143081-solved-disappearing-_post-vars-from-array/#findComment-750398 Share on other sites More sharing options...
amites Posted January 30, 2009 Author Share Posted January 30, 2009 thank you, I managed to solve it had a lingering duplicate field with the same name well below this one that was not set to an array, and thus overwriting what I had took me a couple fresh looks Link to comment https://forums.phpfreaks.com/topic/143081-solved-disappearing-_post-vars-from-array/#findComment-750422 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.