I have a html form that users of my site can type in, click submit and then mysql inserts this into the database, and for some reason when this gets submitted to my 'bio' column which is longtext and utf8_unicode_ci format, if a user types jame's its showing as jame\'s and i dont want these slashes.
Does anyone know why this is happening and how i can get rid of slashes? thanks
html:
<form action="includes/changebio.php" method="post" id="form1">
<textarea id="bio" style="width: 448px;
margin-top:3px;
text-align:left;
margin-left:-2px;
height: 120px;
resize: none;
border: hidden;" textarea name="bio" data-id="bio" maxlength="710"><?php echo htmlspecialchars($profile['bio']); ?></textarea>
<input type="image" src="assets/img/icons/save-edit.png"class="bio-submit" name="submit" value="submit" id="submit"/>
</form>
php:
<?php ob_start(); ?>
<?php
require_once("session.php");
require_once("functions.php");
require('_config/connection.php');
?>
<?php
session_start();
include '_config/connection.php';
$bio = htmlspecialchars($_POST['bio']);
$result = mysql_query("SELECT bio FROM ptb_profiles WHERE id=".$_SESSION['user_id']."");
if(!$result)
{
echo "The username you entered does not exist";
}
else
if($bio!= mysql_result($result, 0))
{
echo "";
$sql=mysql_query("UPDATE ptb_profiles SET bio ='".mysql_real_escape_string($bio)."' WHERE id=".$_SESSION['user_id']."");
}
header("Location: {$_SERVER['HTTP_REFERER']}");
?>
<?php ob_end_flush() ?>