Welcome Guest, Not a member yet? Register   Sign In
Input.php library cleaning value from $_POST, CI3.1.13
#1
Bug 
(This post was last modified: 08-17-2023, 11:45 PM by surjitkmr.)

My html form have these 2 dropdown fields with same name (layout[]), When im submitting the form, im not getting value in controller. I have debug the issue and reach to Input.php. in this script post method not have 'layout' field value in $_POST, but when i print $_POST in CI_Input -> _contructor then it have 'layout' field value.
I have seen this issue only for fields which have name 'layout[]'.
earlier it was working with php5.6 and ci3.1.12 but when we upgrade to php8.1 and ci3.1.13 it stop working.
any one can help me to fix this? thanks in advance. 

<form action="https://10.60.51.246:81/app/dashboard/settings" class="form-horizontal" method="post"><div style="display:none">

<input type="hidden" name="ci_csrf_token" value="8d1d35c39ea2aa18588c3ccb9a7f3985">

<select name="layout[]" id="layout.0">
<option value="0">None</option>
<option value="1">1</option>
<option value="2" selected="selected">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>

<select name="layout[]" id="layout.1">
<option value="0">None</option>
<option value="1">1</option>
<option value="2" selected="selected">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</form>
Reply
#2

Hello, I think this issue might be related to the way CodeIgniter handles form inputs with square brackets in their names, as it uses them to parse the input as an array. However, square brackets in input names can sometimes cause conflicts or unexpected behavior. If you are comfortable modifying the framework's core files, you can try updating the system/core/Input.php file to handle the array input with square brackets correctly. However, note that modifying core files is generally not recommended as it can cause issues during future updates or upgrades of CodeIgniter.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB