Is this code right for using a default variable, it's just I want it to use a default if it can't find the one from E.g. /index.php?id1=67&id2=78 it will use id2 if it can't find ID1? <?php echo $_GET['id1']; if (!empty($_GET['id2'])) ?> PHP: ID1 being the one it's looking for and ID2 being the one it uses if it can't find ID one? Is that right? Thanks for your help!
<?php if (!empty($_GET['id1'])) { echo $_GET['id1']) } elseif (!empty($_GET['id2'])) { echo $_GET['id2']) } ?> PHP:
That would probably be best actually. If ID2 is a set default value for all, then yes example: <?php if (!empty($_GET['id1'])) { $var = $_GET['id1']; } else { $var = "78"; //Value of ID2 (example) } echo "id number value = $var"; ?> PHP: