isset()
just checks to see if a variable is set and does not have a value of null. It does not return the value from that variable (if it is set and does not have a value of null).
Here's a change to your code that uses isset()
to check to see if $_POST['idlab']
is set. If so, $name
is assigned its value. If not, $name
is assigned "Unknown".
$name = isset($_POST['idlab']) ? $_POST['idlab'] : 'Unknown';