|
-
Jul 1st, 2007, 01:51 PM
#1
Thread Starter
WiggleWiggle
[RESOLVED] Setting Cookie
I have the following code located at the top of my page:
PHP Code:
//Checks if the forum was submited...
if ($_POST['email'] == "" && $_POST['password'] =="") {
//if it was not, check to see if cookies exist...
if (isset($_COOKIE['email']) && isset($_COOKIE['password'])) {
//if so, set in a var and put in a textbox
$mememail = $_COOKIE['email'];
$mempassword = $_COOKIE['password'];
} else {
if their not set, make vars = to nothing
$mememail = "";
$mempassword = "";
}
} else {
//form was submited, set cookies if checked
if ($_POST['remeber']=="checked") {
setcookie("email", $_POST['email']);
setcookie("password", $_POST['password']);
}
}
and it doesnt work. . There are no error, it just doesnt call the cookie. I dont think it is set right.
My usual boring signature: Something
-
Jul 1st, 2007, 04:13 PM
#2
Re: Setting Cookie
If you set error_reporting(E_ALL) then you will find out why your code doesn't work .
-
Jul 1st, 2007, 11:11 PM
#3
Thread Starter
WiggleWiggle
Re: Setting Cookie
i dont have access to my php.ini file though.
My usual boring signature: Something
-
Jul 2nd, 2007, 03:30 AM
#4
Re: Setting Cookie
error_reporting is a function. Call it at the top of your script:
PHP Code:
<?php
error_reporting(E_ALL ^ E_STRICT);
// rest of code
?>
And then fix any notices/warnings/errors that are produced. You should do this for all scripts.
-
Jul 2nd, 2007, 04:09 AM
#5
Re: Setting Cookie
Do the cookies (munch, munch, yum, yum ) actually exist?
If you're using IE7 (or plugin for IE6) or FF you can view all the current cookies saved which is a good way to check
-
Jul 12th, 2007, 12:12 AM
#6
Thread Starter
WiggleWiggle
Re: [RESOLVED] Setting Cookie
i think i figured it out. Thanks guys
My usual boring signature: Something
-
Jul 15th, 2007, 07:02 AM
#7
Re: [RESOLVED] Setting Cookie
DClamp can you tell us what went wrong?
Would be useful to know for future searches 
ILMV
-
Jul 15th, 2007, 02:23 PM
#8
Thread Starter
WiggleWiggle
Re: [RESOLVED] Setting Cookie
quite frankly, i have no idea. I would love to tell you but i dont know
My usual boring signature: Something
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|