Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Problem with table output and calendar picker bug

Problem with table output and calendar picker bug

Problem with table output and calendar picker bug

I have been trying to display a table when a user select a data from the datepicker and display a table with the number of columns equal to the number of days to the select month.
However, I have 2 issues and I am not sure I to fix them...

- The datapicker although when selected a specific month, it actually display the previous month instead (ie. selected April, it shows March).

- Portions of the table is shown, is there a way to hide them before a month is selected?

Here is the link to the script I am writing.

Here is the code for generating the table...

CODE --> php

<div class="pull-right form-inline" style="margin-bottom:10px;">
    <div class="form-group">
        <div class='input-group date' id='m_picker'>
          <div class="form-control"><?=!empty($selected_month)?date('Y / m',$selected_time):'Select Month'?></div>
          <input type='hidden' value="<?=!empty($selected_month)?date('Y-m',$selected_time):''?>" />
          <span class="input-group-addon">
            <span class="glyphicon glyphicon-calendar"></span>
 <table id="table2" width="100%" style="margin-top: 10px;">
      <td class="text-right">Date</td>
        <? for ($d = 1; $d <= $days; $d++)    
      	 echo "<td colspan=\"2\" class=\"text-center\">{$d}</td>"; ?>
      <td class="text-center">Group</td>
       <? for ($d = 1; $d <= $days; $d++) {   
       echo "<td class=\"text-center\">Hours</td>
      <td class=\"text-center\">Number</td>"; }?>
    <? for ($i = 1; $i <= 10; $i++) {
		echo "<tr>
      <td class=\"text-center\">name</td>";
	      for ($d = 1; $d <= $days; $d++) {
    	echo "<td class=\"text-right text-blue\">num1</td>
      <td class=\"text-right text-red\">num2</td>"; }
	    echo "</tr>";} ?>
      <td class="text-center"></td>
      <? for ($d = 1; $d <= $days; $d++) { 
		echo "<td class=\"text-right\">num1</td>
      <td class=\"text-right\">num2</td>";} ?>

<script type="text/javascript">
    var test;
		$(function () {
        format: 'YYYY / MM',
        viewMode: 'months'
      $('#m_picker').on('dp.hide', function(e){
        var select_date = e.date._d;
        var month=Math.floor(new Date(select_date).getTime()/1000);
        location.href='_tablework.php?m='+ month;

RE: Problem with table output and calendar picker bug

It looks like the first point has already been addressed.

Before a month is selected, there is no "m" GET value in the URL. You just need to create a conditional situation where you produce the table (empty or not) only when the "m" value is set or not empty.

RE: Problem with table output and calendar picker bug

Hi spamjim,

Thank you for your reply. Thanks for the tips for the second one.

The first one seems to be happening when you pick another month the second time and so on. It didn't seems to happened when you initially pick a month however... Which is weird....

RE: Problem with table output and calendar picker bug

The date displays as expected (2019 / xx) after repeated calendar selections. The number of days per month also appears to be correct for each month selection (28/30/31). Is it possible you have some browser or proxy caching interfering with the output?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close