Insert html/js in db and edit |
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 ?
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').
(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' > |
Welcome Guest, Not a member yet? Register Sign In |