![]() |
CI4 Model Return "&" Instead of "&" - 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: CI4 Model Return "&" Instead of "&" (/showthread.php?tid=77597) |
CI4 Model Return "&" Instead of "&" - mlurie - 09-22-2020 How do you prevent the CI4 model from returning "&" instead of "&" when pulling text from the database? This behavior is desired when I would like to pass data to a view for display, but it is very undesirable when I want to pass data to an input field that is part of an update form view. RE: CI4 Model Return "&" Instead of "&" - nicojmb - 09-22-2020 Have you looked in the database how the string is saved? if you use in form a wyswyg, all html are encoded like the "&". RE: CI4 Model Return "&" Instead of "&" - mlurie - 09-22-2020 (09-22-2020, 06:51 AM)nicojmb Wrote: Have you looked in the database how the string is saved? if you use in form a wyswyg, all html are encoded like the "&". I checked, and it is being saved correctly in the database. However, nicojmb's suggestion prompted me to dig a little deeper. The CI4 model is, in fact, returning "&" and not "&" as it should. It is the Form Helper's set_value() function that is swapping "&" for "&". I did not pay close enough attention to the documentation, and did not set the $html_escape flag to FALSE. All is well now. RE: CI4 Model Return "&" Instead of "&" - nicojmb - 09-22-2020 (09-22-2020, 07:30 AM)mlurie Wrote:(09-22-2020, 06:51 AM)nicojmb Wrote: Have you looked in the database how the string is saved? if you use in form a wyswyg, all html are encoded like the "&". Great!! |