• 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

Symfony - EasyAdmin - Add and remove functions are ignored from AssociationField

cakephp save drag and drop list order to database

Show Custom Data in Woocommerce Order Details Admin Area

Laravel 5.1 Unknown database type enum requested

Display a product custom field only in WooCommerce Admin single orders

Get WooCommerce products from specific category

How to execute sql code based on fetch array

Lumen - Postgresql setup - Composer

Statement that checks whether a URL contains a particular path?

Laravel database insert with combining array and string

PHP Discord OAUTH2 code sample not working

Adding one microsecond to Datetime object in PHP

Manage independently the decimal number of the price of each product [duplicate]

PHP: How to solve ob_start() in combination imagepng() issue?

How to test laravel controller method?

About Contact Privacy policy Terms and conditions