赢得输入字段';t不允许打印某些运算符


Input fields won't allow some operators to be printed

我有一个输入表单,我使用它来在数据库中发布一些数据,问题是它不允许我发布"+"、"&"等字符。

现在我使用了这种格式:

$postPagesashtepi = $_POST["postPagesashtepi"];

表单如下:

<input id="pagesashtepi" name="pagesashtepi" type="text" size="40" value="<?php echo $row['pagesashtepi'];?>

我也使用过filter sanitized,但没有再次成功。。有人能帮我吗?

无论何时将用户提供的内容输出到浏览器,都应该在浏览器上调用htmlspecialchars,以确保人们不会将HTML注入到您的页面中。

您可以使用

 $string=stripslashes($string);

这使您的输入DB 的Un报价

使用此功能进行安全输入

function dbcodec($string){
    $string=stripslashes($string);
    $string=str_replace("''",'''',$string);
    $string=str_replace("'","''",$string);
    $string=str_replace("`","'`",$string);
    $string=str_replace('"',''"',$string);
    $string=str_replace('*',''*',$string);
    return $string;
}

并且您可以使用mysql_real_sescape_string进行转义输入

您在帖子中传递了错误的名称。

$postPagesashtepi = htmlspecialchars($_POST["postPagesashtepi"]);