You can use ?: ternary operator in PHP then you need not empty value. Set value to a $action variable from $_POST[‘action’] parameter if it is not empty or use string default instead. It is shown in the example code below:
// Example usage for: Ternary Operator $action = (empty($_POST['action'])) ? 'default' : $_POST['action'];
For more information see PHP documentation page for Ternary Operator.
In PHP 5.3, a shorter syntax for the ternary operator was introduced, which allows to leave out the middle part of the ternary operator for a quick shorthand evaluation. It is also called the Elvis operator sometimes because: