これは単純に思えますが、なぜうまくいかないのかわかりません。
そのif文を書く必要があります
first, checks if it is numeric
second, if it is not between 1 and 10, issue errorA
third, if it is not between 20 and 30, issue errorB
fourth, it is not a number, issue errorC
が数値ではなく、すべての範囲を満たす場合、データベースに追加されます。
とにかく、これを満たす if と while の組み合わせについてはわかりません....
これまでのところ、
数値で範囲を満たす場合は、データベースに追加します。それ以外の場合は、エラー C を発行します
エラー A と B をフィルタリングするにはどうすればよいですか?
if ( isset [some code...]) {
$a = ...;
$b = ...);
$c = ...;
if (preg_match('/^\d+$/',$b) && preg_match('/^\d+$/',$c) &&
((1 <= $b && 10 >= $b)) && ((20 <= $c && 30 >= $c))) {
$sql = "INSERT [some code...]
mysql_query($sql);
$_SESSION['success'] = $_POST['success'];
header('Location: index.php') ;
return;
} else {
$_SESSION['error'] = $_POST['error'];
header('Location: index.php') ;
return;
}
}