Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php like button counter

<?php
session_start();

if(isset($_POST['likes']))
    ++$_SESSION['likeTemp'];

?>
<form method="post">
<table>
<td><?php echo "Blabla";  ?></td> 
<td><?php echo "Trololo"; ?></td>
<td>
<?php 
    if(isset($_SESSION['likeTemp']))
        echo $_SESSION['likeTemp'];
    else
    {
        $_SESSION['likeTemp'] = 1;
        echo $_SESSION['likeTemp']; 
    }
?>
<input type="submit" value="like" name="likes"></td>
</table>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #button #counter
ADD COMMENT
Topic
Name
6+9 =