• 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

Add Class in html Dynamically in PHP

laravel sanctum Route [login] not defined

woocommerce get_order_report_data to show order_item_id

The difference when using if statement true === something() vs something() === true [duplicate]

Unable to guess the mime type as no guessers are available Laravel 5.2

How can I get new CSRF token in LARAVEL by using ajax

Encrypt in php and decrypt in Dart(flutter)

Inserting Country Selection into MySQL PHP [duplicate]

how to see if database exists with PDO [duplicate]

Autoloading classes in PHPUnit using Composer and autoload.php

I want to display default profile image if user do not have profile image

How to install php yaml on CentOs?

MySQL order by field in Eloquent

merge all files in directory to one text file

Star rating with half star support

About Contact Privacy policy Terms and conditions