mysql - Php multiple isset check doesn't work -
I have 4 inputs and they need to be filled. I did a test but it does not work This is always showing the truth, but not all inputs are full and it is for PHP registration. Can you help me Sorry for my bad english
& lt ;? Php required ('config.php'); (-1) error_reporting; If (isset ($ _POST ['submit'])) {$ username = $ _POST ['username']; $ Iname = $ _POST ['iname']; $ Email = $ _POST ['email']; $ Pass = $ _POST ['pass']; $ Pass1 = $ _POST ['pass1']; If (isset ($ _POST ['username'] ['iname'] ['email'] ['pass'] ['pass1'])) {/ * $ username = $ _POST ['username']; $ Iname = $ _POST ['iname']; $ Email = $ _POST ['email']; $ Pass = $ _POST ['pass']; $ Pass1 = $ _POST ['pass1']; * / If ($ pass1 == $ pass) {$ username = mysqli_real_escape_string ($ link, $ username); $ Iname = mysqli_real_escape_string ($ link, $ iname); $ Email = mysqli_real_escape_string ($ link, $ email); $ Pass = mysqli_real_escape_string ($ link, $ pass); $ Pass1 = mysqli_real_escape_string ($ link, $ pass1); $ Pass = md5 ($ pass); $ Check = "Select user's name from users" Username = '$ username' '; $ rs = mysqli_query ($ link, $ check); $ checker = mysqli_fetch_assoc ($ r); if ($ checker [' user name ' ] == $ username) {echo "username already taken"; go out ();} $ insert = "username '(` id`, `username',` iname`, `email Include in `,` pass_] values (zero, '$ user name', '$ iname', '$ email', '$ pass') "; $ Query = mysqli_query ($ link, $ insert) or die "Query error"); // "INSERT usage VALUES ('NULL', '{$ username}', '{$ iname}', '{$ email}', '(' id ',' username ',' inname ',' email ',' pass' {$ Pass} ') "} and {Echo" password is not match ";}} Else {echo" fill all fields ";}} and {}? & Gt;
I tested all the answers in the comments, but none of them works! I do not understand why this does not work!
You can use it:
if (isset ($ _POST ['username'], $ _POST ['iname'], $ _POST [' Email '], $ _POST [' pa Ss'], $ _POST ['pass1'])) {// your code}
This condition will only return true
if all the arguments are isset () Is set to
and not zero
.
Note: Instead of checking for isset
you empty also
if (isset ($ _POST ['username]', $ _POST ['iname'], $ _POST ['email'], $ _POST ['pass'], $ _POST ['pass1'] $ _POST ['email']. $ _POST ['pass']. $ _POST [' pass1 '])) {$' _POST ['iname']. // your code}
Comments
Post a Comment