好的,我的发布脚本有点问题。一切都很好,除了当我输入一个像撇号一样的短语时,例如“这是我的标题”不会发布,而“这是我的标题”会发布。不知道为什么会这样。也许我真的不知道条形标签,我该怎么办?当它不起作用时,我会收到底部错误消息
} else {
if(isset($_POST['what'])&&isset($_POST['when'])&&isset($_POST['where'])&&isset($_POST['details'])&&isset($_POST['sponsored_by'])&&isset($_POST['collegeId'])){
$what = nl2br(htmlspecialchars(strip_tags(stripslashes(trim($_POST['what'])))));
$where = nl2br(htmlspecialchars(strip_tags(stripslashes(trim($_POST['where'])))));
$when = nl2br(htmlspecialchars(strip_tags(stripslashes(trim($_POST['when'])))));
$sponsored_by = nl2br(htmlspecialchars(strip_tags(stripslashes(trim($_POST['sponsored_by'])))));
$details = nl2br(htmlspecialchars(strip_tags(stripslashes(trim($_POST['details'])))));
$collegeId = intval($_POST["collegeId"]);
if(isset($_SESSION['username'])){
$username = htmlspecialchars(strip_tags(stripslashes(trim(($_SESSION['username'])))));
$query = "select id, Name from users where username='$username' and activated = 1";
$doQuery = mysql_query($query);
if(mysql_num_rows($doQuery)>0){
$results = mysql_fetch_array($doQuery);
$userName = $results['Name'];
$email = $username;
$id = $results['id'];
$query = "insert into events values(NULL,$id,$collegeId,'$what','$when','$where','$details','$sponsored_by',NOW())";
if(mysql_query($query)) header("Location: collegeInfo.php?college=$collegeId&message=added");
else echo "Failed to create new Event!".$query;