• 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 use React Router with Laravel?

find in set in laravel ? example

PHP my timezone is no setting up in PHP.ini File in xampp

Insert database rows from columns of data from associative array of indexed arrays

Prestashop webservice API creating cart rules

How to test a php login connected to a mysql db through xampp?

Calculating Median of an array in PHP

how to upload binary image to sql server using php laravel

PHP: PDO + CSV export not downloading (headers issue?)

Modify microseconds of a PHP DateTime object

Laravel 5.1 how to use {{ old('') }} helper on blade file for radio inputs

phpseclib 2.0 can not use Composer to create autoload

Laravel Blade checkbox not checked

Undefined Array Key error when uploading image on php

Handling expired token in Laravel

About Contact Privacy policy Terms and conditions