Hi guys,
I was doing a bit of experiment in php's session so i can apply something similar to another problem I am working on.
Basically I am implementing a clicker which will count the number of clicks using sessions.
[code='php']
<?php
session_start() ;
if(!isset($_ses sion['val']) )
$_session['val'] = 0;
else
$_session['val']++;
?>
<html>
<body>
<form>
<a href="tester.ph p?v=clicked">Cl ick this Link</a>
</form>
<?php
if($_GET['v'] == "clicked")
$_session['val']++;
echo $_session['val'];
?>
</body>
</html>
[/code]
When I load page for first time i get 0, after first click it echos out 1 as it should but then it doesnt go up any more. Cant see whats different 2nd time and onwards as the value should get incremented.
Any ideas will be appreciated. Thanks heaps.
I was doing a bit of experiment in php's session so i can apply something similar to another problem I am working on.
Basically I am implementing a clicker which will count the number of clicks using sessions.
[code='php']
<?php
session_start() ;
if(!isset($_ses sion['val']) )
$_session['val'] = 0;
else
$_session['val']++;
?>
<html>
<body>
<form>
<a href="tester.ph p?v=clicked">Cl ick this Link</a>
</form>
<?php
if($_GET['v'] == "clicked")
$_session['val']++;
echo $_session['val'];
?>
</body>
</html>
[/code]
When I load page for first time i get 0, after first click it echos out 1 as it should but then it doesnt go up any more. Cant see whats different 2nd time and onwards as the value should get incremented.
Any ideas will be appreciated. Thanks heaps.
Comment