我有我的網站的用戶可以輸入的HTML表單,然後單擊提交,然後mysql插入到數據庫中,由於某種原因,當它被提交到我的'生物'列是longtext和utf8_unicode_ci格式,如果用戶鍵入jame的顯示爲jame的,我不想要這些斜槓。?
有誰知道爲什麼會發生這種情況,以及我如何擺脫斜槓?感謝
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() ?>
您使用的是哪個版本的PHP? – SDC 2013-03-05 12:19:42