Thanks Angie, I was just in the process of seperating out my cookie setting and that is just what I needed. Works like a charm. Thanks again. -Nick
> Also, Please keep in mind that on windows, you will not be able to > successfully set a cookie if your script redirects to another page using > the typical header("Location:.."); command. Instead, you have to print > out headers to the page that uses meta tag refresh to refresh the page > to a new url location. Then the cookie properly sets. Otherwise...it > won't. > > Angie Tollerson > Alliance Technologies > Web Programmer > (515)245-7628 > [EMAIL PROTECTED] > >>>> "George Nicolae" <[EMAIL PROTECTED]> 09/04/02 12:35PM >>> > You can't set a cookie in a page and use it immediately. From the > manual: > "Cookies will not become visible until the next loading of a page that > the > cookie should be visible for. To test if a cookie was successfully > set, > check for the cookie on a next loading page before the cookie expires. > " > > -- > > > Best regards, > George Nicolae > IT Manager > ___________________ > PaginiWeb.com - Professional Web Design > www.PaginiWeb.com > > > "Nicholas Stuart" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> Hello all, I seem to be having problems with getting cookies to set >> correctly. I use the following code: >> ___________________________________________________ >> >> header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); >> header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); >> header("Cache-Control: no-store, no-cache, must-revalidate"); >> header("Cache-Control: post-check=1, pre-check=1", false); >> header("Pragma: no-cache"); >> >> setcookie("User", $_POST['user']); >> setcookie("FirstName", $row["first_name"]); >> setcookie("LastName", $row["last_name"]); >> setcookie("Ext", $row["EXT"]); >> setcookie("Department", $row["dept"]); >> >> \\and to display it: >> <TABLE border = 1> >> <TR> >> <TH>First Name:</TH> >> <TH>Last Name:</TH> >> <TH>Extension:</TH> >> <TH>Department:</TH> >> </TR> >> <TR> >> <TD><?=$_COOKIE['FirstName']?></TD> >> <TD><?=$_COOKIE['LastName']?></TD> >> <TD><?=$_COOKIE['Ext']?></TD> >> <TD><?=$_COOKIE['Department']?></TD> >> </TR> >> </TABLE> >> ___________________________________________________ >> The problem it that the cookie does not set itself the first time the > page >> is loaded. It gives the following error: >> Notice: Undefined index: FirstName in > c:\inetpub\wwwroot\helpdesk\menu.php >> on line 37 >> Once you hit the reload button it works fine. >> And if the cookie is set and the user logs back into the page with a >> different user name then the old info is still set in the cookie > until you >> hit the reload button. >> Thanks for the help! >> -Nick >> >> > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php