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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -