Jump to content

nee some cookie help


batfink1

Recommended Posts

my code below works fine however i need to save this info as a cookie and then echo the cookie not the variable like im doing below.

i've tryed setting it as a cookie but it mess's up the script and it doesn't do what the script is ment to.

if anyone could have a look at this script and get it to save in a cookie and then be retrived that would be great

 

cheers

 

<?php

$sport_list='';

if (isset($_POST['sports'])) {
$sport = $_POST['sports'];
$dts = date("G:i:s d/m/y");
if ($_POST['sport_list']) {
$sport_list = "<li style='text-decoration: underline;'>$sport $dts" . $_POST['sport_list'] . "</li>";
} else {
$sport_list = "<li>$sport $dts</li>";
}
}

?>

<form name="sports" action="<?php echo($_SERVER['PHP_SELF']); ?>" method="post" >
<input type="hidden" name="sport_list" value="<?php echo($sport_list); ?>">
<input type="radio" name="sports" id="e_2" value="FMX" onclick="document.sports.submit();" /><label for="e_2">FMX</label></p>
<input type="radio" name="sports" id="e_1" value="bmx" onclick="document.sports.submit();" /><label for="e_1">BMX</label></p>
</form>

<?php echo($sport_list); ?>

Link to comment
https://forums.phpfreaks.com/topic/165113-nee-some-cookie-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.