|
I am in the process of designing my first solo professional website (yay!) and am interested in creating a simple cookie to store a user`s name so that I can put a simple note saying "Welcome back Mr. User!" whenever they return to the website. I would also be interested in storing their email address for later use in potential newsletters, etc. I have read that this may best be done in PHP, which I know nothing about, but am willing to learn and play with! Any thoughts on how I could do this or links to a good tutorial?
|
|
|
hello Danielle,
it`s PHP cookies technique.
try step by step, ok.
i`m trying the best to help you.
1. create first.php file and put this code :-
<html>
<?php
$user = "Guest";
if ($_COOKIE["name"])
{
$user = $_COOKIE["name"];
}
?>
<form name="form1" method="post" action="/forum/setcookie.html">
<input type="edit" name="user" size="20"></td>
<input type="submit" name="Submit" value="Submit"><br>
</form>
</html>
2. create setcookie.php file and put this code :-
<?php
$yus =$_REQUEST[`user`];
setcookie ("name",$yus);
?>
<html>
Set Cookie Done...
</html>
hopefully it work cause i`d developed my
previous application using this simple technique.
please refer my previous development http://www.vss.com.my/jakim/MainWS.php
click on change area link.
"Gain More Fun Here" http://www.vss.com.my
|
|
|
|
|
hi danielle,
here i`m again...
please ignore first.php file on my previous
message. use this code (first.php) below.
<html>
<?php
$user = "Guest";
if ($_COOKIE["name"])
{
$user = $_COOKIE["name"];
printf("Hello %s<br>",$user);
}
?>
<form name="form1" method="post" action="/forum/setcookie.html">
<input type="edit" name="user" size="20"></td>
<input type="submit" name="Submit" value="Submit"><br>
</form>
</html>
|
|
|
|
|
|
|
|
|
|
|
|