Title: Cookies ($$$)
Course: PHP/MySQL Course

intro to Cookies

Read pages 223 to 225 about the headers sent between the browser and the web server that have cookies in them.

Question:
Who sets cookies

- The php program
- The browser
- The User
- The Database

Set and Delete cookies

Read about setting and deleting cookies on pages 225 to 227.

NOTE: cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to setcookie prior to any output, including <html> and <head> tags as well as any whitespace.

This means that you have to put the php code block before <html>in your file.

Question:

how long till this cookie will expire?

setcookie( "fruit","apple", time()+(3600*24));

- 24 minutes
- 24 hours
- 1 year
- never