Today we will practice how to store user cookie in our signup application and retrieve then when the form was correctly filled. This will assure visitors that their details was successfully received and that they can login at that moment. For testing purpose, copy the code below or write it manually, save it as cookietest.php and run it.
Our php script to submit users details and store copy in cookie container
Again, copy the below php script and paste it on top of your html file combine it with html above and save it as cookietest.php and run the code.
Retrieve users details after filling the form
After the form fully open go on to fill that form, after filling the form click submit. Users will leave the signup page locate a new page indicating a successful signup along with the details they submitted. Those details and information store in cookie container during signup. Save the below code as success.php in same folder where you saved signup.php
Congratulations!
Your registration was successful, you can now login with your:
Username and password
Below details were received and stored in our database.
If you still are unable to login, don't hesitate to contact us.
Destroy user details stored in cookie
It will really impress visitors to see their details after signup, before visitors leave that page there is a clickable link that will destroy the details store in cookie container and redirect them to login page. Now copy the code and save it as deletecookie.php. Super cool!
Summary
If followed the above tutorials correctly it will teach you how you can implement cookie in your application. If the above code spot error, don't hesitate to get in touch. You can submit your question in commentbox below. Thank you for reading this articles.
Comments