Page 1 of 1

cookie

Posted: Mon Jul 12, 2004 3:48 pm
by ddragas
I have problems with cookies.

to set up cookie I use this and it works

Code: Select all

<?php
$expires_soon = date("l, d-M-y H:i:s", time() + 54000);
setcookie( "email=$email;  expires=$expires_soon;");
setcookie( "lozinka=$lozinka;  expires=$expires_soon;");
?>
how to read from cookie?

Posted: Mon Jul 12, 2004 3:51 pm
by feyd
print_r($_COOKIE)

Posted: Tue Jul 13, 2004 2:35 pm
by ddragas
Thank you for reply, And how to put retrived data from cookie to variable?

I've set in coockie values of email and password.

example

$email=email from cookie
$password=password from cookie

with print_r($_COOKIE) i get all values from cookie

Posted: Tue Jul 13, 2004 2:53 pm
by feyd

Code: Select all

<?php

$email = $_COOKIE['email'];
$password = $_COOKIE['password'];

?>
or whatever names you give each cookie...