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:
A method named the same as the class is considered an (old style) constructor, and is called every time the object is created.
So it's called once when the object gets created, and another time when you explicitly call it.
Note that today, it's considered a better practice to implement __construct()
rather than ClassName()
, mainly to help with inheritance.
More reading material: