$karthik=$_POST['myarray1'];
var_dump($karthik);
if($karthik=="ALTA 3.1-06 (CLTA 123.2-06) - Zoning Classification and Allowable Uses - Improved Land "){
echo "correct";
}
else {
echo "incorrect";
}我以"ALTA 3.1-06 (CLTA 123.2-06) - Zoning Classification and Allowable Uses - Improved Land"格式获取数组值,但结果显示为不正确,我想将其显示为正确的。
发布于 2011-06-27 15:03:01
在if语句中的字符串末尾有一个额外的空格。
发布于 2011-06-27 16:18:32
因为$karthik是一个数组,所以$karthik等于数组,你需要用一个键来指定你想要的数组中的哪个值。我相信最简单的方法就是尝试:
if($karthik[0] == "ALTA 3.1-06 (CLTA 123.2-06) - Zoning Classification and Allowable Uses - Improved Land "){
echo "correct";
}
else {
echo "incorrect";
}我不确定最后的空格是不是必需的。
发布于 2011-06-27 15:03:56
我注意到你的末尾有一个空格
"ALTA 3.1-06 (CLTA 123.2-06) - Zoning Classification and Allowable Uses - Improved Land "也许这就是导致你的错误的原因?你可以试着修剪你的弦。
https://stackoverflow.com/questions/6489548
复制相似问题