0

Hello everyone,
I am trying to put a value into $value;
after the value is clicked the count stays at one or it resets itself any help will be awesome

Thank you.

<table width="61%" border="1" align="center" cellpadding="4">
<?php

$count = 1;
if (isset($_GET['value'])) {
	$count++;
	$value[$count] = $_GET['value'];
	print "<tr><td><big>You clicked: $value[$count]</big></td></tr>";
}
$data = 10;
for ($i=1; $i<=$data; $i++) {
    print "<tr><td><a href=\"?value=$i\">Data: $i</a></td></tr>";
}
?>
</table>
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Gonzo10
0

Seems to work fine for me, I modified it a little so you could see the value of $value[$count] at the bottom of the script

<table width="61%" border="1" align="center" cellpadding="4">
<?php

$count = 1;
if (isset($_GET['value'])) {
	$count++;
	$value[$count] = $_GET['value'];
	print "<tr><td><big>You clicked: $value[$count]</big></td></tr>";
}
$data = 10;
for ($i=1; $i<=$data; $i++) {
    print "<tr><td><a href=\"?value=$i\">Data: $i</a></td></tr>";
}
?>
</table>
<br />value of $value[$count] = <?php echo $value[$count]; ?>
0

Thanks R0bb0b,
I added this at then very end of the code and count doesn't seem to increase, please help thank yo

<br />value $count = <?php echo $count ?>

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.