这是我的代码:
$criterias = $_POST['criteria'];
$criteriaValue = $_POST['criteriaValue'];
$comments = $_POST['Comments'];
foreach ($criteriaValue as $key => $value ){
foreach( $criterias as $criteriaValue ){
if( $criteriaValue == $key ){
$string1 = $key;
//echo $string1;
foreach( $comments as $comment => $comm ){
if( $string1 == $comment ){
$string3 = $comm;
//echo $string3;
}
}
}
}
foreach ( $value as $result ){
$string2 = $result;
//echo $string2;
}
$criteria .= mysql_real_escape_string( $string1 . '|' . $string2 . '|' . $string3 . '|' );
}
echo $criteria;
$criteria 将回显 string1 和 string2。但是 string3 是空白的。当我从 foreach 循环中回显时,$string 3 显示了该值。
我真的很感谢大家的帮助!!我认为这可能很简单,但我已经打了我的头。