• 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

Laravel whole batch is cancelled if one Job fails

wordpress : How to specify the cause "This site can’t be reached"

How to connect to MSSQL Server with PHP from Ubuntu 18.04?

PHP7 CLI attempts to load xdebug twice - "Cannot load Xdebug - it was already loaded"

Populate Dynamic Dropdowns List in Codeigniter

Query Optimization, changing the queries in the loop into a single processing query

xdebug 3 not working in ubuntu 20.04 with docker

500 (Internal Server Error) with Laravel & Docker [duplicate]

Is there a way to correctly use sanitize_text_field and wp_unslash that doesn't cause psalm to error with "expects string, possibly different type"

How to add automatically collapse/expand in content wordpress (single.php)?

enroll_table three field fetch to payment form to create payment field in laravel 5.5

How to get transaction details in notify_url page in paypal

Stop caching for PHP 5.5.3 in MAMP

How to send parameters in soap request in php in __soapcall() function

Get WooCommerce products from specific category

About Contact Privacy policy Terms and conditions