le 04/12/2005 à 15:11
Problème de cookie
Salut !
La fonction setcookie est à déclarer avant TOUT code html.
Essaye ça :
La fonction setcookie est à déclarer avant TOUT code html.
Essaye ça :
<?php
session_start();
setcookie("connect[login]" , $_SESSION['login2'] , time()+3600);
setcookie("connect[pass]" , $_SESSION['pass2'] , time()+3600);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>Page de test</title>
</head>
<body>
<?php
$_SESSION['login2'] = "Black Templar";
$_SESSION['pass2'] = "test";
echo $_SESSION['login2']."".$_SESSION['pass2'];
echo $_COOKIE['connect']['login']."".$_COOKIE['connect']['pass']
?>
</body>
</html>