-1

i have table html code in a var like

$table = "<table style="width: 100%">
    <tr>
        <td>Name</td>
        <td>Age</td>
    </tr>
    <tr>
        <td>Mark</td>
        <td>30</td>
    </tr>
</table>
";

is there a way to edit it in a simple textarea editor (without toolbar) but Does not appear like a source code , appear like design or templat and Then I will save it with a database with php form .

<textarea id="textarea_editor"><?php echo $table; ?></textarea>

Example :

enter image description here

user3745594
  • 43
  • 2
  • 9

1 Answers1

0
"<" replace "&#60;" and   ">" replace "&#62;"

<? 
    $table = "<table style=\"width: 100%\">
        <tr>
            <td>Name</td>
            <td>Age</td>
        </tr>
        <tr>
            <td>Mark</td>
            <td>30</td>
        </tr>
    </table>
    ";
    $tab = str_replace(str_replace($table, "<", "&#60;") , ">" ,"&#62;"); 

?>
<textarea id="textarea_editor"><?php echo $table; ?></textarea>
심심이
  • 59
  • 3