Hi,
I used mysql_real_escape_string to insert a data with apostrophe, in the database, using php.
This works.
But when I want to select this data and display it in a form's field, it does not work. What happens is that the data before the apostrophe is displayed in the field, but what is after the apostrophe is displayed outside of the field.
Any idea? Does mysql_real_escape_string only work for insert?
Here is my code:
$produpd = $_POST['id-uprod'];
$selectprod=mysql_query("SELECT * FROM products WHERE id='$produpd'");
$selectproda=mysql_fetch_array($selectprod);
$test=mysql_real_escape_string($selectproda[description]);
echo "<table border='2' cellspacing='15' cellpadding='15'>";
echo "<tr><td>";
echo "<form action='updatedprod.php' method='post' class='text'>";
echo "<input type='hidden' name='id-uprod' value='$selectproda[id]' />";
//echo ($presstext['id']);
echo "</td></tr><tr><td>";
echo "<input type='text' name='name-uprod' value='$selectproda[name_product]' />";
echo "</td></tr><tr><td>";
echo "$test";
echo "<input type='textarea' rows='8' cols='80' name='desc-uprod' value='".mysql_real_escape_string($test)."' />";
echo "</td></tr><tr><td>";
echo "<input type='text' name='price-uprod' value='$selectproda[price]' />";
...
Thank you for any help! Please!