Jump to content

need some php help?


batfink1

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/164995-need-some-php-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.