• 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

How to add a heading in between checkout fields of WooCommerce

Laravel Mix Uncaught ReferenceError: $ is not defined

How to disable only_full_group_by option in Laravel

Laravel multi auth - Authentication user provider [] is not defined

codeigniter 4 running error first time with xampp

how to remove %20 in the url in php

Call to a member function givePermissionTo() on null

Natural ORDER in Laravel Eloquent ORM

PHP: Convert any string to UTF-8 without knowing the original character set, or at least try

image source not readable

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null

Create a zip file and download it

how do i retrieve and display the alt text of an image in wordpress?

Transform array, set each array element with parent key php

Symfony run hint kernel.secret parameter not found

About Contact Privacy policy Terms and conditions