How to send array from view to model |
how to submit a form containing an array in codeigniter
<form method="post" action="collect_vals.php"> <div><input type="text" name="mytext[]"></div> </div> </form>
E-surf
This is not properly a CodeIgniter problem, but more a general PHP question. See
- https://www.w3schools.com/php/php_forms.asp - https://stackoverflow.com/questions/3314...-php-array - http://comp4711.jlparry.com/display/less...4-handling
Am not sure u understand my question
Here the error am having anyway this my error A PHP Error was encountered Severity: Notice Message: Array to string conversion Filename: database/DB_query_builder.php Line Number: 683 Backtrace: File: /var/www/html/esurf/application/models/Bs_admin_model.php Line: 482 Function: where File: /var/www/html/esurf/application/controllers/hod/Users.php Line: 407 Function: get_all_course_assign_by_search File: /var/www/html/esurf/index.php Line: 316 Function: require_once
E-surf
Your original post made no mention of an error.
From the backtrace, it looks like line 482 in Bs_admin_model.php is calling the query builder's where() with one of the arguments being an array when a string is expected.
I know that I told u Am passing an array variable to my model
That y I ask for help on the proper way to pass array data in codeigniter
E-surf
06-03-2018, 03:49 AM
(This post was last modified: 06-03-2018, 04:21 AM by InsiteFX. Edit Reason: added some examples )
The Query Builder where expects a string as admin said, if you want to pass an array
you need to assign the array index that you want to use in the where clause to a string property and then use it in the where clause. PHP Code: foreach($_POST["array_name"] as $key => $value) What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(06-03-2018, 03:49 AM)InsiteFX Wrote: The Query Builder where expects a string as admin said, if you want to pass an array Ok I give it a try
E-surf
|
Welcome Guest, Not a member yet? Register Sign In |