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

07-08-2009, 12:39 PM
|
|
Junior Member
|
|
Join Date: Jul 2009
Posts: 2
|
|
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?
|

07-08-2009, 12:42 PM
|
|
Junior Member
|
|
Join Date: Jun 2008
Posts: 21
|
|
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>
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
All times are GMT. The time now is 03:32 AM.