• 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

PHP my timezone is no setting up in PHP.ini File in xampp

file_put_content...fail to open stream:Permission denied in Laravel 5

woocommerce get_order_report_data to show order_item_id

Exception thrown during the rendering of a template("Parameter "id" for route "url" must match "[^/]++" ("" given) to generate a corresponding URL.")

SilverStripe unable to populate multiple member Childs

GuzzleHttp Hangs When Using Localhost

MongoDB Duplicate Documents even after adding unique key

Distribute array row data to make multiple new rows

Wordpress 'post_type_link' hides permalink

Laravel 5.1 how to use {{ old('') }} helper on blade file for radio inputs

Laravel relationship belongsToMany with composite primary keys

WHM Enabling mod_rewrite

How to send upload image through email

Cannot retrieve error message using Symfony HttpClient if the response is not "ok"

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

About Contact Privacy policy Terms and conditions