php - Can not display double quotes when saving to database -
i saving double quotes need saved in database, later shown on screen.
$in = '2" 2.33"'; $in = mysqli_real_escape_string($db, $in); echo $in; // shows backslashes $results = $db->query("update store_item_brims set brimsizein='$in' id=2"); // later query database , load array // print_r of array shows no backslashes // echoing text input field not work
when view data in phpmyadmin, saves in database without visible backslashes. when load data array , print_r
array, shown in array. however, when try echo out in input text field user update, shows 2
, cuts off first double quote reached.
how fix this?
when echo in html input quotes mess quotes html input uses deliminators short answer:
<input type="text" value="<?php echo htmlentities($your_value); ?>" ...
reference: htmlentities
Comments
Post a Comment