• 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

Google Calendar API batch request PHP

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

PHP: Print caught exception like Xdebug

Symfony 4: how to allow dynamic values for array nodes in bundle configuration?

Why the name of trucks are same in 2nd and 3rd record of company data retrieval?

how to insert data into select2 search input after scan using qrcode

Getting output of MS stored procedure on php call

User pool client {id}does not exist

No result using makeStyles Material UI in react 18

How can I remove the "Advanced" panel of all blocks in WordPress block editor?

How to use React Router with Laravel?

Laravel Displaying image from database

Sum array values

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

How to add automatically collapse/expand in content wordpress (single.php)?

About Contact Privacy policy Terms and conditions