i need some php help!?

Bat

New member
I need some php help!?
the below script is my page so far. this all works great and when you click a radio button it adds to the running text list the with the last item clicked at the top along with the date and time.

however i would like this info saved in a cookie so when the user closes an reopens the page the same results appear.

i would also like the most recent (top line) of the running text list to be underlined

any ideas people
cheers...code below...

<html>
<head>
<title>Test Sport List</title>
</head>
<body>

<?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>$sport $dts" . $_POST['sport_list'] . "</li>";
} else {
$sport_list = "<li><u>$sport $dts</li><u />";
}
}


?>


<form name="test" 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="01" value="skate" onclick="document.test.submit();" /><label for="01">skateboard</label>
<input type="radio" name="sports" id="02" value="football" onclick="document.test.submit();" /><label for="02">football</label>
</form>


<?php echo($sport_list); ?>


</body>
</html>
 
Very messy code. Not sure I know exactly, but what about using JS to save a cookie onload() and onunload()?

You could use php to create an array of every possible combination, give it an ID number, save that ID as the cookies value.
Then retrieve that cookie, if it exists, and do something based on its value (like return all of those values that correspond with that ID).

Just a suggestion.
 
Back
Top