<?
echo $_POST['aaa'].'<br>';
function htmlpost($x){
$x1=array(' ');
$x2=array(" ");
$x=str_replace($x1,$x2,$x);
return $x;
}
echo $_POST['aaa']=htmlpost($_POST['aaa']);
?>
<form method="post">
<input name="aaa" type="text" id="aaa" value="<? echo $_POST['aaa']; ?>" />
<input type="submit" name="Submit" value="提交" />
</form>在输入框输入连续两个以上空白字符
按第一次提交没有问题,空白字符可以转换 ,但是按第二次提交,空白的字符没有转换为
请问什么原因?
echo $_POST['aaa'].'<br>';
function htmlpost($x){
$x1=array(' ');
$x2=array(" ");
$x=str_replace($x1,$x2,$x);
return $x;
}
echo $_POST['aaa']=htmlpost($_POST['aaa']);
?>
<form method="post">
<input name="aaa" type="text" id="aaa" value="<? echo $_POST['aaa']; ?>" />
<input type="submit" name="Submit" value="提交" />
</form>在输入框输入连续两个以上空白字符
按第一次提交没有问题,空白字符可以转换 ,但是按第二次提交,空白的字符没有转换为
请问什么原因?
这个是bug还是什么原因?
echo $_POST['aaa']=htmlpost($_POST['aaa']);//大哥,你都已经将空格转换后的值赋值给post中的aaa了啊!
//输入:等等等[空格][空格]等等等
//提交后显示结果
<body>
等等等 等等等
<br>
等等等 等等等
<form method="post">
<input id="aaa" type="text" value="等等等 等等等" name="aaa">
<input type="submit" value="提交" name="Submit">
</form>
</body>继续提交<body>
等等等 等等等
<br>
等等等 等等等
<form method="post">
<input id="aaa" type="text" value="等等等 等等等" name="aaa">
<!--不要被input的value值忽悠了-->
<input type="submit" value="提交" name="Submit">
</form>
</body>