Login
Search   Moderators Wanted: If you're interested please send your portfolio to info[at]itechforums.com
Welcome to the iTechForums.
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
To register now click here.
Latest Threads
Advertisements
Forum Statistics
Threads:
Posts: 2
Members:
Number of Users Online:
Welcome to our newest member,
Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2009, 12:39 PM
Bat Bat is offline
Junior Member
 
Join Date: Jul 2009
Posts: 2
Default

i need some php help!?


i need some php help!?

hey i have these 2 pages

process.php
PHP Code:
<?php
$sport = $_POST['sports'];
$date = date("d/m/y");
$time = date("G:i:s");

$data_1 = "$sport $time $date";


setcookie("cookie",$data_1);

header("location: code.php");
?>

and code.php

PHP Code:
<form name="test" action="process.php" method="post" >



<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 "<u>";
echo $_COOKIE['cookie'];
echo "<u />";

?>

so yeah when you click on one of the radio buttons you see
football 23:09:01 01/07/09

but i want a running text list showing the most recent buttons and times you clicked on it not just once. so it would be like


skate 23:53:35 01/07/09
skate 23:49:11 01/07/09
football 23:09:01 01/07/09

i've tryed using arrays but i cant get it to work so yeh wen a button is clicked it adds it to the running text list
any ideas?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2  
Old 07-08-2009, 12:42 PM
rbjolly rbjolly is offline
Junior Member
 
Join Date: Jun 2008
Posts: 21
Default

Ah ha! I'll answer it twice.

<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>$sport $dts</li>";
}
}

?>


<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>

<ul>
<?php echo($sport_list); ?>
</ul>

</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Your Ad Here

All times are GMT. The time now is 03:32 AM.