I\'m facing a problem that my function is called twice everytime i submit my form
my form file with the call to the function:
Your class name is login. You do not have __construct(), and you have a function called login(). So when you instantiate the class, login() is called first since you did not define __construct() , method name same as class becomes the constructor. Then you are calling the login() function again. Hence its called twice.