Most form inputs are always set, even if not filled up, so you must check for the emptiness too.
Since !empty()
is already checks for both, you can use this:
if (!empty($_POST["mail"])) {
echo "Yes, mail is set";
} else {
echo "No, mail is not set";
}
More Related Contents:
- Php if($var) used to work [closed]
- Search Form with One or More (Multiple) Parameters
- Best way to test for a variable’s existence in PHP; isset() is clearly broken
- What’s the difference between ‘isset()’ and ‘!empty()’ in PHP?
- In where shall I use isset() and !empty()
- Delete multiple rows by selecting checkboxes using PHP
- Using if(isset($_POST[‘submit’])) to not display echo when script is open is not working
- PHP Error : Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` [duplicate]
- Calling a particular PHP function on form submit
- What is the PHP shorthand for: print var if var exist
- PHP: Check if variable exist but also if has a value equal to something
- Check if value isset and null
- What is the difference between null and empty?
- PHP shorthand for isset()? [duplicate]
- Is it ” RTSi6+yxLwIW7KsnoehVDA== ” md5? or How to get original string? [closed]
- Creating default object from empty value in PHP?
- How to display HTML tags as plain text [duplicate]
- Call to a member function bind_param() on a non-object [duplicate]
- PHP: Is mysql_real_escape_string sufficient for cleaning user input?
- cleanup php session files
- In php, is 0 treated as empty?
- Implode a column of values from a two dimensional array [duplicate]
- How to remove html special chars? [duplicate]
- How do I display a MySQL error in PHP for a long query that depends on the user input? [duplicate]
- How can I capture the result of var_dump to a string?
- PHP get start and end date of a week by weeknumber
- CodeIgniter MSSQL connection
- Do I need to escape backslashes in PHP?
- onbeforeprint() and onafterprint() equivalent for non IE browsers
- Using utf8mb4 with php and mysql