0

I want my website to remember people's email when they post on my website.

<form method="post" action="formposting.php">
<input type="text" name= "title" size="22">
<input type="text" name= "email" size="22">
<?php 
if(!$_COOKIE['cookname']) {
echo "<input type=\"checkbox\" name=\"remember\" id=\"remember\" /> Remember me on this computer"; 
} 

else{
echo $email; 
echo "Forget Me{delete cookie//help here too}";
} 
?>
</div>
<input type="submit" value="post"/>
</form>


if (isset($_POST['remember'])) {
parse_str($_COOKIE[$cookname]);
$number_of_days = 100000 ;
$date_of_expiry = time() + 60 * 60 * 24 * $number_of_days ;
setcookie( "cookname", "anonymous", $date_of_expiry, "/", "url.com" );  
}

What i don't know is how display the user's email, if user wants to post again at a later date, if it was checked and if it wasn't checked show the input type for email and if they click forget me it should forget them and show input type for email

Edited by tunde011: n/a

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by vaultdweller123
0

HI,

first of all, it's not a good idea to store the mail plain, better generate a crypt key, and same the email on your side with the key.

Anyway it would be like this:

<form method="post" action="formposting.php">
<input type="text" name= "title" size="22">
<input type="text" name= "email" size="22">
<?php 

if(!$_COOKIE['cookname']) {

 echo "<input type=\"checkbox\" name=\"remember\" id=\"remember\" value="<?php if($_COOKIE[$cookname]) print $_COOKIE[$cookname];  ?>"/> Remember me on this computer"; 
} 

else{
echo $email; 
echo "Forget Me{delete cookie//help here too}";
} 
?>
</div>
<input type="submit" value="post"/>
</form>


if (isset($_POST['remember'])) {
	parse_str($_COOKIE[$cookname]);
	$number_of_days = 100000 ;
	$date_of_expiry = time() + 60 * 60 * 24 * $number_of_days ;
	setcookie( "cookname", $_POST['remember'], $date_of_expiry, "/", "url.com" );  
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.