4SeeN
1
Maybe it’s from lack of sleep but i’m stumped.
<?php
if ($_SESSION['captcha_status'] = 'failed'){
echo '<strong>You entered the verification code incorrectly, please scroll down and try again</strong>';
session_destroy();
}
?>
My web page displays the echo content always. Whether $_SESSION[‘captcha_status’] has a value or not, the echo content displays at all times.
Any ideas?
Thank you in advance.
smftre
2
<?php
if ($_SESSION[‘captcha_status’] == ‘failed’){
echo ‘<strong>You entered the verification code incorrectly, please scroll down and try again</strong>’;
session_destroy();
}
?>
You missed the second equals in the if.
Indeed.
Your assigning the value ‘failed’ to your session var, assigning always equates to true so you’ll always be caught by your if statement.
Change to == or ===.

4SeeN
4
lol funny, wow. Thank you guys 
//better approach
if ($_SESSION['captcha_status'] == 'failed'){
echo '<strong>You entered the verification code incorrectly, please scroll down and try again</strong>';
unset($_SESSION['captcha_status'] );
}
4SeeN
6
May I ask why this is a better approach? I just started working with sessions a few days before this post.
Thank you in advance 