I need help with this code. I need it to not loop every time I reload the page. Please take a look and let me know if there are any suggestions for fixing this issue. Thank you in advance.
[php]
if( !isset($_COOKIE[‘lang’]) ) {
setcookie( “lang”, “en”, time()+604800, “/”); /* expire in 1 week /
echo ‘no cookie’; #cookie isn’t set
}
else if( $_COOKIE[‘lang’] == ‘en’ ) {
setcookie( “lang”, “sp”, time()+604800, “/”); / expire in 1 week /
} else {
setcookie( “lang”, “en”, time()+804800, “/”); / expire in 1 week */
}
echo 'start ' . $_COOKIE['lang'];
echo '<br><br>';
echo 'finish ' . $_COOKIE['lang'];
exit;
[/php]