php - unable to understand the behaviour of the isset and empty in the following form -
i have form username , password , value gets posted check.php when have no input in username , password,(left blank), isset($_post["username"]) , isset($_post["password"]) returns true, should not did not set anything. empty($_post["username"] returns true expected. can explain behaviour of isset.
thanks
if submit form elements...
<input name='username'... ...but they're empty, fill $_post array empty values default. so, variables set, they're empty ("").
what in case like
if (isset($_post['username'] && $_post['username']) { ... } in case, check if it's set (that is, form submitted) , if values aren't empty. if they're empty ("") php interpret false , condition not met.
Comments
Post a Comment