dreamwest Posted November 15, 2008 Share Posted November 15, 2008 how can i show new visitors a message when they first arrive. i want to use a cookie once they have confirmed the message example: {if}has cookie - dont show any message{else} <a href="site.com">confirm message</a>{/if} Quote Link to comment https://forums.phpfreaks.com/topic/132796-set-cookie/ Share on other sites More sharing options...
dreamwest Posted November 15, 2008 Author Share Posted November 15, 2008 i think im closer to what i need, but i still have no idea how to get a cookie within and if/else code: if (cookie_name == yes) { $customize = 'user dosent have cookie named "yes" '; } else { $customize = 'if user has "yes" cookie they will see this message'; } Quote Link to comment https://forums.phpfreaks.com/topic/132796-set-cookie/#findComment-690609 Share on other sites More sharing options...
Maq Posted November 15, 2008 Share Posted November 15, 2008 Out of curiosity, are these pages using PHP? Cause it would be so much easier, and easier for me to answer. Example: if (isset($_COOKIE["yes"])) echo "Cookie exists! "; else echo "Cookie does not exist... "; ?> Quote Link to comment https://forums.phpfreaks.com/topic/132796-set-cookie/#findComment-690638 Share on other sites More sharing options...
dreamwest Posted November 15, 2008 Author Share Posted November 15, 2008 Out of curiosity, are these pages using PHP? Cause it would be so much easier, and easier for me to answer. Example: <html> <body> <?php if (isset($_COOKIE["yes"])) echo "Cookie exists! <br />"; else echo "Cookie does not exist...<br />"; ?> </body> </html> yes all are in php Quote Link to comment https://forums.phpfreaks.com/topic/132796-set-cookie/#findComment-690668 Share on other sites More sharing options...
Maq Posted November 15, 2008 Share Posted November 15, 2008 Then you can check to see if the user has the cookie names "yes" with the isset... Use the example I provided you. Quote Link to comment https://forums.phpfreaks.com/topic/132796-set-cookie/#findComment-690861 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.