PHP, MySQL validation malfunction and search doesn't work?

前端 未结 2 423
无人共我
无人共我 2021-01-26 08:49

I have created a small registration sticky form. Everything is working fine, but if I input any wrong value,like numbers in name, letters in age or even wrong email format, then

2条回答
  •  迷失自我
    2021-01-26 09:44

    As for your first question, don't check for $var, check for !empty($var).

    Second question: I am not sure I understand what you are trying to do. But don't you mean $row instead of $rows when you are displaying something? Also, what if you have more than one search hit? What you want is:

    while($row=mysql_fetch_assoc($result)){
       echo $row['Firstname'], ' ', $row['LastName'];
    }
    

    instead of your if-else construction.

提交回复
热议问题