PHP and cookies

A

Anonymous

Guest
Hi all

I wonder if any one can help me?

I'm trying to write a php form using cookies, so when the user enters his/her details in the form the next time they return the info is there.....

I cracked this using one <input type="text" name="name"> box.

But the problem is I want 2 input boxes not one. And I cant seem to get it to work. this is the next input box I want to go in there:

<input type="text" name="address">

Any help would be very much appreciated

Below is a sample of the code I have done so far:

====================================

<?php

if ($myCookie=="")

{

setcookie("myCookie",$name, time() + 60*60*24*365*10);

?>
<form action="<?=$PHP_SELF?>" method="post">
<input type="text" name="name">
<input type="submit" value="submit">
</form>
<?php

}

else

{

setcookie("myCookie",$var, time() + 60*60*24*365*10);

?>
<form action="<?=$PHP_SELF?>" method="post">
<input type="text" name="name" value="<?=$myCookie?>">
<input type="submit" value="submit">
</form>
<?php

}

?>
 
Could you please help me on this I am very new to php and I would not know where to place that function.

Thanks mate :)
 
Well thank you so much for your help....

You was as much use as a bull in a china shop!
 
Back
Top