batfink1 Posted July 7, 2009 Share Posted July 7, 2009 the following produces a running text list dislaying a value date and time each time a radio button is clicked and underlines the first in the text list. but what i want is the latest addition to the text list underlined so the top line of text instead of the bottom line. anyhelp is greatly appreciated. I've tryed p2graces suggestion on the underlining but it didn't work thanks anyway <?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<u /></li>"; } } setcookie("sport",$sport_list); ?> <html> <head> <title>Test Sport List</title> </head> <body> <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($_COOKIE['sport']); ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/165009-underline-using-php-help/ Share on other sites More sharing options...
p2grace Posted July 7, 2009 Share Posted July 7, 2009 Can you give me the value of the $sports_list var? Your best bet is to make it an array, that way you can use logic in your iteration to create the underline. Also you have an error in your html <u /> isn't a valid tag. Also, I would recommend not using the <u> at all since it isn't compliant with W3C standards. Instead I would use the css alternative: style="text-decoration: underline;" Link to comment https://forums.phpfreaks.com/topic/165009-underline-using-php-help/#findComment-870118 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.