Search code examples
phphtmlvariablesisset

PHP if multiple variables exist


So i'm having a bit of a problem with having my PHP run a command if multiple variables exist. I made a simple version for people to see what i'm trying to fix easier. Thanks in advance to anyone who can help :)

<?php
if ((isset($finalusername)) && if (isset($finalpassword)) && if (isset($finalemail)))
  echo "This will save.";
?>

Solution

  • if (isset($finalusername, $finalpassword, $finalemail))
    

    Also see The Definitive Guide to PHP's isset and empty.