Whats wrong with my cookies?
- by William
For some reason This php script won't echo my cookie variable:
<?php
require 'connection.php';
require 'variables.php';
$name = $_POST['name'];
$pass = $_POST['pass'];
if(($name == $admin_name) && ($pass == $admin_pass)){
setcookie($forum_url."name",$name,time()+604800);
setcookie($forum_url."pass",$pass,time()+604800);
}
else
echo 'Failed';
?>
heres the html that gets sent to admin_login.php
<form method=post action=admin_login.php>
<div id="formdiv">
<div class="fieldtext1">Name</div>
<div class="fieldtext1">Pass</div>
<input type="text" name=name size=25 />
<input type="password" name=pass size=25 />
</div>
<input type=submit value="Submit" id="submitbutton">
</form>
here is the index, where I want the info echoed
<?php echo $_COOKIE[$forum_url."name"]; ?>
What am I doing wrong?