views:

1431

answers:

3

I normally name my db specific fields in my forms like this "objectname[columnname]", I tseems CI cant access these values using $this->input->post('objectname[columnname]'), what do I do? there is not a chance in hell im renaming 100+ form fields.. I am actually disliking CI, it really is getting in the way of progress by changing the de facto PHP norms...

A: 

I seems I can rely on the $_POST var, but I thought this was reset?

bananarepub
CI destroys the $_GET variable, not $_POST.
jimyi
+7  A: 

And were you using $_POST['objectname[columnname]'] or $_POST['objectname']['columnname'] ?

Have you tried the equivalent for the latter

$obj = $this->input->post('objectname');
echo $obj['columnname'];

?

If it works, you can write you own helper to retreive that like post_val('objectname[columnname]').

streetpc
great, thanks for the tip dude!
bananarepub
no problem. if it solves your problem, could you accept the answer ? so that anybody coming later with the same problem sees it ?
streetpc
Is this the proper way that codeigniter does it?
Kieran Andrews
Writing a helper function would be the cleanest way I see, apart from modifying CI.
streetpc
A: 

I just went with the $_POST['objectname']['colname'] option as i usually do even though this is probably not the CI way..

bananarepub
It does work but its not the CI way and avoids all sorts of things like global XSS cleaning.
Phil Sturgeon