Closed Thread
Results 1 to 5 of 5

Thread: little help with my code -.-

  1. #1
    hardinera's Avatar
    hardinera is offline Learning Programmer
    Join Date
    Jul 2009
    Posts
    42
    Rep Power
    0

    little help with my code -.-

    Code:
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

        <html xmlns="http://www.w3.org/1999/xhtml">

        <head>

        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1″ />

        <title>Calendar</title>

        <style type="text/css" media="all">
            body {
                background-color: #2A2A2A;
                color: #EEEEEE;
                font-family: Tahoma, Verdana, sans-serif;
                font-size: 10px;
            }

            table {
                width: 125px;
            }
               td {
                padding: 1px;

                border: 1px solid #666666;

                text-align: center;
            }
        </style>
        </head>
        <body>

        <?php

            
    // get this month and this years as an int

            
    $thismonth = ( int ) date"m" );
            
    $thisyear date"Y" );

            
    // find out the number of days in the month

            
    $numdaysinmonth cal_days_in_monthCAL_GREGORIAN$thismonth$thisyear );

            
    // create a calendar object

            
    $jd cal_to_jdCAL_GREGORIANdate"m" ),date), date"Y" ) );

            
    // get the start day as an int (0 = Sunday, 1 = Monday, etc)

            
    $startday jddayofweek$jd );

            
    // get the month as a name

            
    $monthname jdmonthname$jd)

        
    ?>

        <table>

            <tr>

                <td colspan=”7″><div align=”center”><strong><? $monthname ?></strong></div></td>

            </tr>

            <tr>

                <td><strong>S</strong></td>

                <td><strong>M</strong></td>

                <td><strong>T</strong></td>

                <td><strong>W</strong></td>

                <td><strong>T</strong></td>

                <td><strong>F</strong></td>

                <td><strong>S</strong></td>

            </tr>

            <tr>

        <?php

         

            
    // put render empty cells

         

            
    $emptycells 0;

         

            for( 
    $counter 0$counter <  $startday$counter ++ ) {

            

                echo 
    "\t \t <td> - </td> \n";

                
    $emptycells ++;


            }

            
    // renders the days

            
    $rowcounter $emptycells;

            
    $numinrow 7;

            for( 
    $counter 1$counter <= $numdaysinmonth$counter ++ ) {

                
    $rowcounter ++;

                echo 
    "\t \t <td> $counter </td> \n";

                if( 
    $rowcounter $numinrow == ) {

                    echo 
    "\t </tr> \n";

                    if( 
    $counter $numdaysinmonth ) {

                        echo 
    "\t <tr> \n";

                    }

                    
    $rowcounter 0;

                }

            }

            
    // clean up

             
    $numcellsleft $numinrow – $rowcounter;

            if( 
    $numcellsleft != $numinrow ) {

                for( 
    $counter 0$counter $numcellsleft$counter ++ ) {

                    echo 
    "\t\t<td>-</td>\n";

                    
    $emptycells ++;

                }

            }

        
    ?>

            </tr>

        </table>

        </body>

        </html>
    thanks -.- i have error in line 139 dont know what it means -.-

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jaan Guest

    Re: little help with my code -.-

    Code:
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

        <html xmlns="http://www.w3.org/1999/xhtml">

        <head>

        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

        <title>Calendar</title>

        <style type="text/css" media="all">
            body {
                background-color: #2A2A2A;
                color: #EEEEEE;
                font-family: Tahoma, Verdana, sans-serif;
                font-size: 10px;
            }

            table {
                width: 125px;
            }
               td {
                padding: 1px;

                border: 1px solid #666666;

                text-align: center;
            }
        </style>
        </head>
        <body>

        <?php

            
    // get this month and this years as an int

            
    $thismonth = ( int ) date"m" );
            
    $thisyear date"Y" );

            
    // find out the number of days in the month

            
    $numdaysinmonth cal_days_in_monthCAL_GREGORIAN$thismonth$thisyear );

            
    // create a calendar object

            
    $jd cal_to_jdCAL_GREGORIANdate"m" ),date), date"Y" ) );

            
    // get the start day as an int (0 = Sunday, 1 = Monday, etc)

            
    $startday jddayofweek$jd );

            
    // get the month as a name

            
    $monthname jdmonthname$jd)

        
    ?>

        <table>

            <tr>

                <td colspan='7'><div align='center'><strong><?php echo $monthname ?></strong></div></td>

            </tr>

            <tr>

                <td><strong>S</strong></td>

                <td><strong>M</strong></td>

                <td><strong>T</strong></td>

                <td><strong>W</strong></td>

                <td><strong>T</strong></td>

                <td><strong>F</strong></td>

                <td><strong>S</strong></td>

            </tr>

            <tr>

        <?php

         

            
    // put render empty cells

         

            
    $emptycells 0;

         

            for( 
    $counter 0$counter <  $startday$counter ++ ) {

            

                echo 
    "\t \t <td> - </td> \n";

                
    $emptycells ++;


            }

            
    // renders the days

            
    $rowcounter $emptycells;

            
    $numinrow 7;

            for( 
    $counter 1$counter <= $numdaysinmonth$counter ++ ) {

                
    $rowcounter ++;

                echo 
    "\t \t <td> $counter </td> \n";

                if( 
    $rowcounter &#37; $numinrow == 0 ) {

                    
    echo "\t </tr> \n";

                    if( 
    $counter $numdaysinmonth ) {

                        echo 
    "\t <tr> \n";

                    }

                    
    $rowcounter 0;

                }

            }

            
    // clean up

             
    $numcellsleft $numinrow-$rowcounter;

            if( 
    $numcellsleft != $numinrow ) {

                for( 
    $counter 0$counter $numcellsleft$counter ++ ) {

                    echo 
    "\t\t<td>-</td>\n";

                    
    $emptycells ++;

                }

            }

        
    ?>

            </tr>

        </table>

        </body>

        </html>
    I fixed some things..

  4. #3
    hardinera's Avatar
    hardinera is offline Learning Programmer
    Join Date
    Jul 2009
    Posts
    42
    Rep Power
    0

    Re: little help with my code -.-

    jaan thanks for help hehe your code is running i replaced
    Code:
    #37; with % 

    i'm just wondering is there a tutorial where i can learn how to create availability calendar that is connected to a database? thanks

  5. #4
    Jaan Guest

    Re: little help with my code -.-

    What do you mean about that availability calendar ?

  6. #5
    hardinera's Avatar
    hardinera is offline Learning Programmer
    Join Date
    Jul 2009
    Posts
    42
    Rep Power
    0

    Re: little help with my code -.-

    the form is kinda like this... ...sorry for my drawwing hehehe the dates are dynamic u can scroll with cliccking the "<<" and ">>"

    little help with my code -.--.jpg

    anybody have idea?
    Last edited by hardinera; 03-21-2010 at 07:33 PM.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problem in a href location from php code to html code
    By newphpcoder in forum PHP Development
    Replies: 5
    Last Post: 05-13-2011, 02:03 PM
  2. how to make a bar code reader program in VB 2008 please send me the code
    By tontonskie in forum Visual Basic Programming
    Replies: 1
    Last Post: 11-15-2010, 12:58 AM
  3. add code for font size under php echo code
    By newphpcoder in forum PHP Development
    Replies: 2
    Last Post: 11-10-2010, 11:03 PM
  4. Code: Capture Code from USB Camera
    By MrNobody in forum Visual Basic Tutorials
    Replies: 71
    Last Post: 08-14-2009, 08:59 AM
  5. Code: Capture Code from USB Camera
    By MrNobody in forum Tutorials
    Replies: 5
    Last Post: 09-08-2007, 06:00 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts