I'm looking for a better and easy way to do this. I remember I saw a shorthand somewhere.
if (isset($user['passport'])) $passport=$user['passport'];
Edited to let you know what I mean
Classic ASP:
user=request.form("user")
response.write user
ASP doesn't care if user exists, so prints nothing
The same in PHP
$user=$_POST['user'];
echo $user;
PHP prints Notice: Undefined variable
If you need shorthand condition than you can use ternary operator
as:
$passport = (isset($user['passport']) ? $user['passport'] : '');