• 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

Jquery DataTables: Data not displaying in table via Ajax

PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known

Add 2 Webcam in one page with WebcamJS

Can I use a WooCommerce function without any WooCommerce page?

WooCommerce - unset "<product> removed notice…" on cart page

PHP Get value from JSON [duplicate]

How to solve cURL error 60: SSL certificate in Laravel 5 while Facebook authentication

Send Outlook 2010 email using PHP

Extract string between first whitespace and last whitespace in php

php curl requesting twice

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

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

Install mysql client in docker image

Inserting Country Selection into MySQL PHP [duplicate]

Render the content of default_filter.php in Joomla front-end

About Contact Privacy policy Terms and conditions