batfink1 Posted July 7, 2009 Share Posted July 7, 2009 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 More sharing options...
p2grace Posted July 7, 2009 Share Posted July 7, 2009 One thing you could do is save the results in a mysql table with a hashed unique key, then save the key as a cookie. Then simply call the results from the database based off of that key. Link to comment https://forums.phpfreaks.com/topic/165113-nee-some-cookie-help/#findComment-870655 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.