Welcome Guest, Not a member yet? Register   Sign In
bug when setting $_POST array field to null?
#6

(10-27-2015, 06:40 AM)Narf Wrote: You're not showing the actual code, but the lines that you did show have "i" as the index that you're setting to NULL and 1 as the one you're trying to fetch afterwards ...

sorry for not showing the actual code as it's quite long.

so basically line:
if (strlen($_POST['sold_for_price'][i]) == 0) $_POST['sold_for_price'][i] = null;


is within a for loop, it will check for each sold_for_price array field, if it is not entered (ie. strlen = 0), it will be set to null


so in my example, $_POST['sold_for_price'][1] will be null (the second field is not entered), what I'm saying is, if $_POST['sold_for_price'][1] is manually set to null, $this->input->post('sold_for_price')[1] won't return null


Again this only happens in array field, ie. if I do $_POST['total_price'] = null, $this->input->post('total_price') is also null.
Reply


Messages In This Thread
RE: bug when setting $_POST array field to null? - by redjersey - 10-27-2015, 01:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB