• 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

advanced custom fields wordpress custom class

Adding reCAPTCHA v2 into my PHP file

Create tags in laravel post publishing

How do I call Validator from a namespace with an already existing Validator class

How can I get data from PHP to Android TextView?

How To Access A Column In M-M Relationship Table In Laravel

Not able to override collapsible.js in magento 2

Facebook PHP SDK - will not logout properly

Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?

Assets not referencing to public folder (Laravel)

How to find the date a user created their Google account

Sentry + Laravel: how to log an already catched Exception?

XAMPP keeps showing Dashboard/Welcome Page instead of the Configuration Page

Mysqli Output to a table

Problem with fetching data from database in Laravel

About Contact Privacy policy Terms and conditions