database records with ' in the data - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: database records with ' in the data (/showthread.php?tid=28253) |
database records with ' in the data - El Forum - 03-06-2010 [eluser]filip_de_backer[/eluser] Hi, This is the code: $adres = $list['l_adres'] . " " . $list['l_postcode'] . " " . $list['l_gemeente']; $list[''] --> this is a column from teh database. But in the l_adres, there is the character ' When I use the $adres in a html control, the data gets lost because of: echo "<input id='adresHidden' name='adresHidden' type='hidden' value='" . $adres . "'/>"; How can I convert it to another character? Is there a CI helper methode that converts special characters to html codes? thanks, Filip database records with ' in the data - El Forum - 03-06-2010 [eluser]jplanet[/eluser] use: htmlentities($adres) database records with ' in the data - El Forum - 03-06-2010 [eluser]JoostV[/eluser] or Code: echo '<input id="adresHidden" name="adresHidden" type="hidden" value="' . $adres . '"/>'; or Code: $this->load->helper('form'); database records with ' in the data - El Forum - 03-06-2010 [eluser]jplanet[/eluser] [quote author="JoostV" date="1267887649"]or Code: echo '<input id="adresHidden" name="adresHidden" type="hidden" value="' . $adres . '"/>'; Keep in mind that will break if the value of $adres contains a double-quote... database records with ' in the data - El Forum - 03-06-2010 [eluser]JoostV[/eluser] [quote author="jplanet" date="1267888128"] Keep in mind that will break if the value of $adres contains a double-quote...[/quote] True |