This question already has an answer here:
I am trying to put a json on an html input. Here is my code:
$data = [
'name' => addslashes("Maria"),
'message' => addslashes("It's fun in here."),
];
And on HTML
<input type="text" name="data" value='<?php echo ( json_encode( $data ) ); ?>'>
I added addslashes
to the values but I'm still getting this:
Any help would be appreciated.