• 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 can I remove the "Advanced" panel of all blocks in WordPress block editor?

XDebug not working in VScode for php debugging

Convert every two values of an associative array into key-value pairs

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

How to pass security cloudflare server with php curl

insert multiple rows in a saveall in cakephp

how to identify the web server name of remote host

Add a custom text for a particular product on specific email notification in Woocommerce

Return multiple values from a function using mysqli_fetch_assoc [closed]

args[max_input] woocommerce if statement confused

GRPC installed successfully on ubuntu but php is looking for it in another folder

TesseractOCR not working for Laravel

"Mixed content blocked" when running an HTTP AJAX operation in an HTTPS page

Detect if PHP session exists

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

About Contact Privacy policy Terms and conditions