Insert html/js in db and edit - 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: Insert html/js in db and edit (/showthread.php?tid=75278) |
Insert html/js in db and edit - pippuccio76 - 01-21-2020 HI , sorry for english , hi want to save in my db a code like this : PHP Code: var uri = 'https://pippo.com' + new String (Math.random()).substring (2, 11); This is a js script , hi want treat it like simple text , booth insertion and edit . To try , i insert directly this code in db but if i echo the code i see a clickable image . How can i save it as simple text and show as simple text ? RE: Insert html/js in db and edit - jreklund - 01-21-2020 If you want to render it (so you can edit it). You will need to echo it inside a <textarea>your code</textarea>. In case you wan't to display it (for a programming guide?) you can use html_escape('your code'). RE: Insert html/js in db and edit - pippuccio76 - 01-21-2020 (01-21-2020, 11:17 AM)jreklund Wrote: If you want to render it (so you can edit it). You will need to echo it inside a <textarea>your code</textarea>. In case you wan't to display it (for a programming guide?) you can use html_escape('your code'). Thanks i solve it , for show in list i use : <?= htmlspecialchars($row->codice)?> To show in input i use : $val=htmlentities($record->codice) and <input class='form-control' type='text' value="<?=$val?>" id='id_class_codice' name='codice' maxlength='65535' > |