I have a form that I use in my CPanel. When I enter data into the form with apostrophes or quotes, such as:
There's an example
It is saved in my database as:
There\'s an example
I don't understand why the quotes are being escaped automatically.
- I don't have anything set to escape the posted data
- It is updated using a prepared statement
- Magic quotes are off (gpc, runtime, and sybase)
Here is my PHP code that updates the database:
<?php
include "{$_SERVER["DOCUMENT_ROOT"]}/global/php/db.mysqli.php";
$title = $_POST["title"];
$subtitle = $_POST["subtitle"];
$dir = $_POST["dir"];
$parts = $_POST["parts"];
$override = $_POST["override"];
if($override == "true" || $override == true)
$override = 1;
else
$override = 0;
$stmt = $link->prepare("UPDATE ... SET `title`=?, `subtitle`=?, `dir`=?, `parts`=?, `override`=? WHERE `id`=? LIMIT 1");
$stmt->bind_param("ssssss", $title, $subtitle, $dir, $parts, $override, $id);
$stmt->execute();
?>