• 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 upload binary image to sql server using php laravel

php curl requesting twice

Changing font color in javascript

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

Destroy session upon refresh

Fatal error: Trait 'LaminasDbAdapterLaminasDbAdapterAdapterInterface' not found in /var/www/vendor/laminas/laminas-db/src/Adapter/Adapter.php

Laravel Command Schedule Not Working Properly

selected value from the listbox in php

How to properly start Laravel 8 with Bootstrap & authentication

Can't find vendor/autoload.php for Ratchet

Laravel get user data with profile

Last order would be re-order in wooCommerce. How is it possible?

Change the alert text on add to cart action without selected variation in Woocommerce

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

json_encode turns array into an object

About Contact Privacy policy Terms and conditions