get increment decrement day once clicked button

get increment decrement day once clicked button

Content Index :

get increment decrement day once clicked button
Tag : php , By : francisco santos
Date : November 28 2020, 09:01 AM

this will help There is already a date function available to find the number of days

     include 'theme-head.php'; 
     include 'theme-header.php';

     $currentmonth = date('m');
     $currentyear = date("Y");
     $currentyeartotday = date('t');

     $months = array('January','February','March','April','May','June','July','August','September','October','November','December');
     //$years = array('2010','2011','2012','2013','2014','2015','2016','2017','2018','2019','2020');

    //sets initial value of SESSION variables to current month, year and total day
        $_SESSION['month'] = $currentmonth;
        $_SESSION['year'] = $currentyear;
        $_SESSION['totalday'] = $currentyeartotday;
    //increments or decrements year month and totalday based on user input
    if(isset($_POST['NextMonth'])) {
        if ($_SESSION['month']+1 == 13){
        $_SESSION['month'] = ($_SESSION['month']+1 < 13) ? ++$_SESSION['month'] : 1;
        $_SESSION['totalday'] = cal_days_in_month(CAL_GREGORIAN, $_SESSION['month'], $_SESSION['year']);

    if(isset($_POST['LastMonth'])) {
      if($_SESSION['month']-1 == 0){ 
      $_SESSION['month'] = ($_SESSION['month']-1 > 0) ? --$_SESSION['month'] : 12;
      $_SESSION['totalday'] = cal_days_in_month(CAL_GREGORIAN, $_SESSION['month'], $_SESSION['year']);
    //current year month and totalday based on user input
        $_SESSION['year'] = $currentyear;
        $_SESSION['month'] = $currentmonth;
        $_SESSION['totalday'] = $currentyeartotday;
    } ?>

    <div  class="col-md-2">
      <input type="text" placeholder="date month year" readonly>

    <div class="col-md-9">
        <div class="well"> 
            <form method="post">
                <button class="fa fa-chevron-circle-left btn-primary btn btn-xs" name="LastMonth" type="submit">Last</button>
                <button class="fa fa-chevron-circle-right btn-primary btn btn-xs" name="NextMonth" type="submit">Next</button> <?php
                if (isset($_POST['NextMonth'])){  ?>
                    <button class="btn-primary btn btn-xs" name="Today" type="submit">this month</button> <?php
                } elseif (isset($_POST['LastMonth'])) { ?>
                    <button class="btn-primary btn btn-xs" name="Today" type="submit">this month</button> <?php     
                } else { ?>
                    <button class="btn-primary btn btn-xs" name="Today" type="submit" disabled>this month</button> <?php
                } ?>
                <div class="pull-right">
                    <h2><?php echo ''. $months[$_SESSION['month']-1] .' '. $_SESSION['year'].''?></h2> <?php
                    echo''. $_SESSION['totalday'] .' ' ?>

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

When is post-decrement/increment vs. pre-decrement/increment used in real-life examples?

Tag : development , By : user152319
Date : March 29 2020, 07:55 AM
it fixes the issue The obvious is when you want the old value returned, you use post-increment.
The more subtle things are that pre-increment should really never be slower and could be faster due to the lack of creating a temporary and returning the old value when using post-increment.
set<int> ctr;

set<int>::iterator it = set.begin();

// Post-increment so the value returned to erase is that of the previous
// iteration (i.e. begin()), yet the iterator stays valid due to the local
// iterator being incremented prior to the erase call

// Still valid iterator can be used.
cout << "Value: " << *it << "\n";  

Increment / decrement button In ExtJS

Tag : development , By : jonagh
Date : March 29 2020, 07:55 AM
This might help you You can use this 3rd party extension...

What is the difference between variable post-increment/decrement and pre-increment/decrement in bash?

Tag : bash , By : Timbo
Date : March 29 2020, 07:55 AM
may help you . Quoting from Increment and decrement operators:
$ x=5; echo $(( x++ / 2 ))
$ echo ${x}                     // The effect of post-increment is visible here

Increment/Decrement when a radioButton is clicked jQuery

Tag : javascript , By : moss
Date : March 29 2020, 07:55 AM
seems to work fine Check if any radio button is clicked in that group. Update your script to
var financedDiv = Number($('.financed div').html().trim());
var NonfinancedDiv = Number($('.non-financed div').html().trim());
var cbxFinancedInvioces = $('#cbxFinancedInvoices');
var cbxUnfinancedInvoices = $('#cbxUnFinancedInvoices');
var checkVal = $("input[name='InvoiceStatus']:checked").val();
cbxFinancedInvioces.on('change', function () {        
    if (this.checked) {                
        financedDiv = financedDiv + 1;
        $('.financed div').html(financedDiv);
        if(checkVal) {
            NonfinancedDiv = NonfinancedDiv - 1;
            $('.non-financed div').html(NonfinancedDiv);
        checkVal = true;


cbxUnfinancedInvoices.on('change', function () {
    if (this.checked) {               
        NonfinancedDiv = NonfinancedDiv + 1;
        $('.non-financed div').html(NonfinancedDiv);
                    if(checkVal) {
            financedDiv = financedDiv - 1;
            $('.financed div').html(financedDiv);
        checkVal = true;

How to make buttons that increment and decrement a value when clicked?

Tag : javascript , By : enginecrew
Date : March 29 2020, 07:55 AM
it should still fix some issue The document.write is the problem. It only works before the browser is done loading the page completely. After that, document.write doesn't work. It just deletes all of the existing page contents.
Your first document.write is executed before you the page has loaded completely. This is why you should see the 0 next to the two buttons.
var x = 0;
var span = document.querySelector('span'); // find the <span> element in the DOM
var increment = document.getElementById('increment'); // find the element with the ID 'increment'
var decrement = document.getElementById('decrement'); // find the element with the ID 'decrement'

increment.addEventListener('click', function () {
  // this function is executed whenever the user clicks the increment button
  span.textContent = x++;

decrement.addEventListener('click', function () {
  // this function is executed whenever the user clicks the decrement button
  span.textContent = x--;
<button id="increment">increment</button>
<button id="decrement">decrement</button>
Related Posts Related QUESTIONS :
  • How to compare 2 array of PHP objects then fill in empty string if data not match?
  • strtotime gives back false result to strings in an array
  • How to create Url that contain name and id laravel
  • Codeigniter: Models not working with an error: Undefined property: CI_Loader
  • How to use + or - operators as parameters in Doctrine prepared SQL statement?
  • How to run scrapy with url parameters from php on linux debian
  • Preg matching imgur.com links
  • Php - Code comparing value of database to the value send by android app
  • Laravel pagination object in javascript
  • Error in validating message of no votes PHP
  • Symfony site on Azure with ClearDB connection
  • Woocommerce upsell with checkboxes
  • How to login/logout with Hybridauth 3?
  • Convert INT number in PHP
  • php/mysql. selecting 2 common fields in 2 tables
  • Expand an string based on values in an array in PHP
  • When you absolutely have to manually escape SQL in CakePHP 3.4.7
  • Htaccess redirecting wrong page
  • Laravel Optional WHERE clause
  • PHP unpack overlfow variable memory limit
  • How to check the URL's structure using PHP preg_match?
  • PHP preg_replace - text will not be recognized
  • Show image from other domain without showing the domain name - PHP
  • How to run and watch local server at the same time?
  • Access form request from Observer laravel
  • single quote problem with preg_replace_callback
  • How to Create A Unique URL for each product enquiry form for Google Analytics Tracking
  • Laravel email configuration: what am I missing?
  • Assign indexed array values to multidimensional array?
  • Custom WordPress stylesheet not loading
  • Data attribute only returning first value
  • How to list all roles with Permissions,in spatie permission Package?
  • How to achieve this number pattern with n input
  • How to iterate array inside array data in laravel ,output are given below
  • To get output of movie with its genre
  • Extracting some data from a JS object literal string in PHP using Regex
  • axios and vuex are deleting wrong index in array
  • Setting empty CURLOPT_POSTFIELDS
  • Laravel 5.8 use subdomain as API endpoint beside domain.com/api
  • Error while add data in database SQL Server 2016
  • Does PhpStorm allow to skip PHPDoc tags when type hints is declared?
  • html classes are changed to Attributes
  • Using json to import multidimensional data
  • passing data from the view to the controller, where the data comes from another controller
  • How to extract integer and decimal numbers in PHP string correctly?
  • Parsing Sub-Object from an XML Feed with objects
  • Getting error "Unknown column 'text' in 'field list'"
  • How to properly get onedrive access token via php and curl
  • How to add spell check to a php function
  • Is it posible to create css rules with php?
  • Pretty URL with $_GET method
  • Wordpress always load same page - index.php
  • Find value in array and return with new from different array
  • PHP multiple file upload with different keys
  • Can't modify times one a time without weird errors
  • Get size of scraped image with domcrawler (Goutte)
  • Laravel - Ordering a collection of models
  • PHP Fatal error: Uncaught Error: Call to a member function setFetchMode() on boolean
  • Strict Standards: Only variables should be passed by reference in /main_dir/sub_dir/backup.php
  • Uncaught Google_Exception: (update) unknown parameter: 'copyRequiresWriterPermission'
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com