I need to make echo for each next situation
if points typed is <0 echo can't be negative number
if points typed is 0 echo clean 0
if points typed is > 50 echo you passed test
if points typed is 100 echo you finished with best result
and all of this I made easy but thing is in next one
if points typed is text echo points can't be text
problem is, whenever I type text I get echo both for < 0 and if(preg_match($pattern,$points))
and removing - from pattern doesn't solve the problem
here is code
<?php
$select=$_POST['select'];
if(isset($select) and $select=="submit"){
$points=$_POST['points'];
if ($points < 0){
echo "Points can't be negative"; }
$pattern = "/^(?:100-|\d{1,2})$/";
if(preg_match($pattern,$points))
{
if ($points == 0) {
echo "Clean 0"; }
if ($points > 50 && $bodovi < 100) {
echo "You passed test"; }
if ($points == 100) {
echo "You finished with best result"; }
}else {
echo "Points can't be text";
}
}
?>
<form method=post name=points action=''><input type=hidden name=select value=submit>
<table border="0" cellspacing="0" >
<tr>
<td><div align="right">
<p>Number of points:</p>
</div></td>
<td>
<input type=text name=points size=15 >
</td></tr>
<td>
<input type=submit value=Ispisi>
</td>
</table>
</form>