我有一个带有文本区域的简单表单,当提交时会更新我的数据库中的行!我希望我的用户能够在其中输入单引号,但由于某种原因没有被解析!这就是我的解析文件..
<?php
$sql = "SELECT * FROM testimonials WHERE id='$pid'";
$pid = $_POST['pid'];
$testtitle = htmlentities($_POST['ts_tt']);
$testbody = htmlentities($_POST['ts_tb']);
$compowner = htmlentities($_POST['ts_co']);
$ownertitle = htmlentities($_POST['ts_ot']);
$compname = htmlentities($_POST['ts_cn']);
$compwebsite = htmlentities($_POST['ts_cw']);
include_once "../php_includes/db_conx.php";
$sql = "UPDATE testimonials SET testtitle='$testtitle', testbody='$testbody', compowner='$compowner', ownertitle='$ownertitle', compname='$compname', compwebsite='$compwebsite' WHERE id='$pid'";
if (!mysql_query($sql, $connection)){
die('Error: ' . mysql_error());
}
echo 'Testimonial has been Edited successfully. <br /><br /><a href="admin/">Click Here</a>';
exit();
?>
任何想法!非常感谢 - 菲利普