PHP, shorthand, If..Else using ternary operators
Is there a oneliner for this? Good OP Ternard?
$F_NAME = $_SESSION['USR']['F_NAME'];
if(isset($_POST['F_NAME'])) {$F_NAME = $_POST['F_NAME'];}
Basically "If a POST is sent, show that even if the message is empty, otherwise grab the value from the session, but only if the message was not set or is empty"
Really splitting hair here ...
looking for something like this:
$F_NAME = ? ($F_NAME ? isset($_POST['F_NAME']) : $_SESSION['USR']['F_NAME']);
+3
source to share
2 answers