form validation in_list - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: form validation in_list (/showthread.php?tid=71947) |
form validation in_list - sh1ny - 10-16-2018 Hi, Is there any way to pass an array into in_list[] form validation? i.e. If I want to verify a value returned from a form exists in a DB column, and I get the column values as an array of values (no keys), is there a way to get in_list to read the array rather than hardcoding the values? Thanks RE: form validation in_list - jreklund - 10-16-2018 Yep, but you need to implode it first. So that your array turns into comma separation instead. PHP Code: $array = [0 => 'red', 1 => 'green', 2 => 'blue']; RE: form validation in_list - sh1ny - 10-16-2018 (10-16-2018, 08:40 AM)jreklund Wrote: Yep, but you need to implode it first. So that your array turns into comma separation instead. Thanks for the answer, it's greatly appreciated. |