php - Error with passing parameters -
this question has answer here:
when passing parameters login function in authenticate class these errors:
notice: undefined index: user in c:\users\adam\phpstormprojects\website\login.php on line 11 notice: undefined index: pass in c:\users\adam\phpstormprojects\website\login.php on line 12
this function in authenticate class
public function login($user,$pass){}
and login.php params getting passed from.
$authenticateuser = new authenticate(); $queryresult = $authenticateuser->login(($email),($password));
does understand why getting these errors?
check html form has input fields make sure having correct tags names.
<input type="text" name= "user" value=""/> <input type="text" name= "pass" value=""/>
and make sure passing post in method="post" not get.
then print $_post , $_get first thing on php page , exit() check if getting input.
print_r($_post); print_r($_get); die("done...");
then must validate post array see if user typing in form , not submitting empty. guess have validation class can use framework, if not, @ least validate plainly.
if(isset($_post["user"]) && !empty($_post["user"]) && strlen($_post["user"])>1) { //do stuff } else { //show error }
Comments
Post a Comment