• 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

I want a way to give path to my files which are outside of public folder in laravel

Adding Multiple Custom Post Types in Wordpress

How to render html from a @foreach loop in a textarea

SilverStripe unable to populate multiple member Childs

Webscraping Symfony/Panther: Can't get HTML

How to remove from a multidimensional array all duplicate elements including the original?

Make Calculator - When Button clicked the No shows in Textbox.

Issue saving card for customer

Limit WooCommerce products in cart only from one custom taxonomy

carbon generated datetime not stored correctly into the database

Unit (real unit test) of test laravel relationship

How can I make good efficent AJAX live forms with just jQuery and

Access relation of pivot table in Laravel

Adding the custom page with add_menu_page function on Wordpress

Laravel views are showing from cache on one server but works fine on other server

About Contact Privacy policy Terms and conditions