CodeIgniter Forums
function old() not allow input name type array - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: function old() not allow input name type array (/showthread.php?tid=70253)



function old() not allow input name type array - HTLove - 03-13-2018

Hi.

PHP Code:
<input id="meta[full_name]" name="meta[full_name]" placeholder="Full name" value="<?= old('meta[full_name]'); ?>" type="text" class="form-control "

After post, it not store old input data from form, because it store in $_SESSION['_ci_old_input']['post'] type array.

How to get old data from input name type array.
Thanks all


RE: function old() not allow input name type array - HTLove - 03-13-2018

Hi
And i try name = meta.full_name not accept.
I debug, it replace meta.full_name to meta_full_name

Tks


RE: function old() not allow input name type array - InsiteFX - 03-14-2018

form_helper set_value


RE: function old() not allow input name type array - HTLove - 03-14-2018

It no affect, i use redirect()->back()->withInput(); redirect page


RE: function old() not allow input name type array - kilishan - 03-14-2018

(03-13-2018, 06:07 PM)HTLove Wrote: Hi.

PHP Code:
<input id="meta[full_name]" name="meta[full_name]" placeholder="Full name" value="<?= old('meta[full_name]'); ?>" type="text" class="form-control "

After post, it not store old input data from form, because it store in $_SESSION['_ci_old_input']['post'] type array.

How to get old data from input name type array.
Thanks all

I barely have time to breathe with the couple of jobs I'm working that are nearing deadlines currently, but I believe I finally implemented that a month or two ago where you can access it in "dot array" notation. So, it would be like:

Code:
old('meta.full_name')

If that doesn't work, though, please raise an issue at GitHub so I remember to implement that when I have a chance to surface in a couple of weeks.


RE: function old() not allow input name type array - HTLove - 03-15-2018

Yes, it not work.
Thanks


RE: function old() not allow input name type array - gabpnr - 03-21-2018

Hi,

it is fixed.
You can use old('meta.full_name') as kilishan said.