• 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

Require a class from another class - php

Natural ORDER in Laravel Eloquent ORM

PHP mail function is sending blank message body

if statement inside concatenation

Render the content of default_filter.php in Joomla front-end

Last order would be re-order in wooCommerce. How is it possible?

Split array into 4-element chunks then implode into strings

RabbitMQ PRECONDITION_FAILED - unknown delivery tag

How to get variable from JavaScript to PHP [duplicate]

CodeIgniter extend CI_URI undefined method

Prestashop cUrl Login

Warning: A non-numeric value encountered

woocommerce_wp_select options array from product attribute terms

PHP - Check if string contains words longer than 4 characters, then include "+ *", and for those shorter than 4 characters include only "*"

Laravel no logout option from menu after successfull login

About Contact Privacy policy Terms and conditions