I'm trying to check to see if a $_GET value is available AND equal to 1 but the error is that the index is not defined.
<?php if ((isset($_GET['success'])) || ($_GET['success'] == 1)) { ?>
Do Something
<?php } ?>
Why is this a problem? I'm checking to see if it exists and then if it equals one and if so , do something.
Is there a better way to achieve this goal?
Change the || (OR) to && (AND)
if ((isset($_GET['success'])) && ($_GET['success'] == 1))
do this <?php if (isset($_GET['success']) { if($_GET['success']==1){} ?>
Do Something
<?php } ?>
You need to change the OR for an AND in the conditional (&&)
||
= OR
&&
= AND, which is what should have been used.