When I save this string in PHP:
John: "Yes you can".
In my database is saved as:
John: \
How can I save these strings with ” ( without deleting ” obviously ).
This is my php code:
$titlepost= mysql_real_escape_string($_POST['title']);
$query = "INSERT INTO `titles` (`title`) VALUES ( '".$titlepost."')";
$res = mysql_query($query) or die("Failed".mysql_error() );
echo $titlepost;
output:
John: \\
FORM:
$title = mysql_real_escape_string($_GET['title']);
<form method="post" action="title.php?done=yes" enctype="multipart/form-data">
<input type="text" size="25" name="title" <?php echo "value=\"".$title."\""; ?> >
<input id="starit" name="submit" value="titleit" type="submit" />
</form>
Your problem has nothing to do with PHP or MysQL.
It is as silly as very simple HTML syntax rule.
It is quite obviously that the code
will show only quoted “John: ” part.
To make it correct, one have to encode special symbols in the value
As for the slashes – it is silly excessive quoting issue. just quote your strings only once and make sure you have
magic_quotes_gpcturned off