php比较两个数据判断用户提交的表单数据是否已经存在
<?php $choices = array('my choice 1', 'my choice 2', 'my choice 3'); $valid = true; if (is_array($_GET['inputArray'])) { $valid = true; foreach($_GET['inputArray'] as $input) { if (!in_array($input, $choices)) { $valid = false; } } if ($valid) { echo "Input Value were found in choices"; } } ?>