• 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 to delete old images from public folder on update using Laravel

Upload a file Using PHP and JavaScript

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

Magento 2 - How to add new block to admin panel in product page?

Laravel Unknown Column 'updated_at'

Laravel dosen't connect with Oracle

Too few arguments to function PendingResourceRegistration::name(),1 passed in C:xampphtdocsproject outesweb.php on line 18 and exactly 2 expected

correct PHP headers for pdf file download

Confirm Leave on External Links in Wordpress

Laravel: Create morphs() relationship nullable

passwordless LDAP login and get user information using Kerberos ticket in PHP

Display a product custom field only in WooCommerce Admin single orders

Star and Half Star Rating in Laravel

PHPUnit 7: Failed asserting that exception of type InvalidArgumentException is thrown

phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO)

About Contact Privacy policy Terms and conditions