My code does not error, but does not compile either. Nothing happens: / [closed]

-2

I do not know what happens in the code. It does not error, but also does not insert and does not go to the Login screen and also does not enter the else "error"

    
asked by anonymous 21.05.2018 / 04:31

1 answer

1

How to diagnose?

To make this diagnosis of what happens, you have to analyze what is being passed through the POST request and see if everything is being supplied to your PHP application, check the correct spelling of the variables (uppercase, lowercase, etc.). In your case, this should be ...

Why do not you see the error?

It does not display the error inside the else because it validates (and enters) the first

if(isset($_POST['agencia']) && empty($_POST['agencia']) == false)

and goes to the internal validations that do not have else, failing either of them (account or password) ...

Correcting the error

Add some more elses there to debug your application in an easier way, informing the user every error, in case the second if puts an else and echoes: "You must enter the account number", in the next validation, echoes : "you must enter the password", and so on ... If an if passes, and an error occurs internally, it does not go to the else of the previous one.

Extra tip

Your code is susceptible to SQL injection attacks ... You have to prepare the input variables before with $ sql-> mysql_real_escape_string ($ _ POST ['agency']). The addslashes function is not recommended for this as this answer .

    
21.05.2018 / 07:16