I am using CodeIgniter, I am getting dynamically select boxes. From the second select box, the user can select the status and according to the status input field will display.
Check this below screenshot, If the user clicked on Add More
then below select box will display.
Now from the second select box, I choose Status one
so according to the selected value, remark input field displayed. Check below screenshot.
If the user wants more fields for ID 2 then the user will click on add Bank
. For example, I clicked two times and I chose a status. so It will display like this. because Each row has one status field.
There is no issue in UI till now, Now I am submitting the data into the database. But when I am submitting the data into the database then I am getting the error Message: Uninitialized string offset: 0
and sometimes Message: Uninitialized string offset: 1
.
The issue I am getting on the second dropdown because according to selected value input field displaying and If I choose Status one
then remark field is getting the value but date and remark and amt and reason are showing offset: 1
error for the first row.
You can find my HTML here: https://jsfiddle.net/7vthpbmc/
I am using below logic.
My controller code is
Gurpreet Singh Padam
This error would occur if any of the following variables were actually strings or null instead of arrays, in which case accessing them with an array syntax
$var[$i]
would be like trying to access a specific character in a string: