• 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 convert time from one timezone to another in PHP

could not find driver Debian SQL Server PHP

Attempt to read property "view" on null when sending password reset email

How to remove from a multidimensional array all duplicate elements including the original?

phpseclib 2.0 can not use Composer to create autoload

PHP Imap , php 7.4.3 on mac osx catalina

javascript html popup window

wp_remote_get() not passing authentication

Sort multidimensional array by column value within a column

How to increase the PHP upload limits [duplicate]

How to keep value of selected value after form submission?

MySQL order by field in Eloquent

How to make a array inside array?

Destroy session upon refresh

Laravel Collections. Is there some kind of assertStructure method?

About Contact Privacy policy Terms and conditions