how can I prevent PHP from returning an Undefined variable error every time I try to check a variable if it has contents and that certain variable hasn\'t b
The variable will be always SET as long as you sent the form .
form
So its better to check of the variable is not empty.
empty
if(!empty($_POST['var']))