I have a page that displays the records created in a different area of the site. This page displays the records and allows the user to update the content. There's a textarea field that usually contains apostrophes (for example, We're, I've, It's ... etc).
The text field area is displayed with htmlentities:
<textarea name="deal_detail" cols="35" rows="2" id="details"><?php echo htmlentities($row_Recordset1['deal_detail'], ENT_COMPAT, ''); ?></textarea>
When I click save, it tries to update the record (Note: It saves it perfectly well if it doesn't have apostrophes).
$updateSQL = sprintf("UPDATE deals SET deal_title=%s, deal_detail=%s, deal_image=%s, renov=%s WHERE id_deals=%s",
GetSQLValueString($_POST['deal_title'], "text"),
GetSQLValueString($_POST['deal_detail'], "text"),
GetSQLValueString($_POST['deal_image'], "text"),
GetSQLValueString($renov, "int"),
GetSQLValueString($_POST['id_deals'], "int"));
I've tried moving the $_POST[deal_detail] to a variable, using htmlspecialchars and mysqli_real_escape_string before updating, but nothing happens, I keep getting the same usual error when it tries to update because it recognizes the apostrophe as part of the code, not the text.
I've read like 50 different posts here about similar questions or info, but nothing seems to work. I wonder if using htmlentities affects ...