• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Increase value by 1 on button click

php


PHP Snippet 1:

<form action="" method="post">
<input type="submit" name="click_button" value="Click..">
</form>
<?php
session_start();

if (isset($_POST['click_button'])) {
    $_SESSION['clicks'] += 1 ;
} else {
    $_SESSION['clicks'] = 0;
}

echo($_SESSION['clicks']);

Related Snippets

How to install php_imagick on wamp64

phpunit - testing is painfully slow

Return new collection without modifying original collection

MySQL/PHP - Web Based Game -User specific inventory table or 1 giant table? Another option?

Issue with laravel eloquent model property

Doctrine ORM: Excluding Records Based on Values of Nested Relationships

Wordpress wpdb->delete issue

How to change 'users' auth table and use another instead Laravel

Laravel query builder binding parameters more than once

Change user role if checkout custom checkbox is checked in WooCommerce

Sentry + Laravel: how to log an already catched Exception?

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

Prestashop cUrl Login

PHP Find Array Index value in multi-line array

Dynamic table in HTML using MySQL and php

About Contact Privacy policy Terms and conditions