I want to know the short form of this my php if / else condition.
if(isset($_POST['name']) && strlen($_POST['name']) > 0)
{
$name = addslashes($_POST['name']);
}
else
{
$name = '';
$flag = '0';
}
i have made this.. but this is not valid for $flag
$name = (isset($_POST['name']) && strlen($_POST['name']) > 0 ? addslashes($_POST['name']) : ''); // returns true
Aucun commentaire:
Enregistrer un commentaire