Beginner PHP Tutorial – 75 – Creating Cookies with PHP


Video is ready, Click Here to View ×

Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –

40 thoughts on “Beginner PHP Tutorial – 75 – Creating Cookies with PHP

  1. Thank you. I love your videos. I have a difficult task though for my FMA i have to submit in 2 weeks. I have to create a form. I have to submit it to another page and if there are errors the same page needs to be redisplayed plus the data that is already valid must exist so the user does not have to repeat.
    Could you do a video on advanced form handling with php without REGEX please???????? Many Thanks in advance

  2. Thanks for these powerful videoes about php. I am using WAMP server but when trying to setcookie
    $time = time();
    it gives an error
    what is the reason for that?

  3. If you would like an easy way to set time in cookies you could paste in this simple function ( ), made by me. This is how you use it:
    timeAdd(3, "d")  This sets time 3 days from now.
    This is how it should be looking in the setcookie:
    setcookie("cookiename", "cookievalue", timeAdd(3, "d"));
    Here's the values you're able to use in the second string:
    "m"  – Minute
    "h"   – Hour
    "d"   – Day
    "W"  – Week
    "M"   – Month
    "Y"   – Year
    The first value requires only a int which will be how many, for example, years the cookie should stay if "Y"-case.
    The function might not always be accurate because some months doesn't always have 31 days.

  4. Damn. I was stuck for a good 15mins trying to figure out why my cookie would not set (was using print_r($_COOKIE); to see all cookies). Turns out I had to use double quote instead of single ones. Makes NO sense. Great consistency php designers. -_-

  5. I was reading the comments and had a genius idea. People should stop bitching about all the tiny little things "wrong" with the tutorials and appreciate the fact that Alex takes time out of his day to do this for free.

  6. I think Bucky should redo this series when he has time, every time I start to try to memorize something, alex goes "ummmm why isn't this working, oh yeah I forgot the most important part,let me just change that at the speed of light and switch screens."

  7. @MrJohnPringle. that is because of the error_reporting setting in your php.ini file. change it accordingly and u shouldn't be getting it anymore.
    put it as error_reporting = E_ALL & ~E_NOTICE

Leave a Reply

Your email address will not be published. Required fields are marked *