Results 1 to 3 of 3

Thread: mohon pertolongan..camne function nak bagi tambah event ni?

  1. #1
    Join Date
    May 2007
    Location
    perak
    Posts
    4
    Rep Power
    0

    mohon pertolongan..camne function nak bagi tambah event ni?

    i really need ur fever guys...sape leh tlong camne nak masukkn function supaya event boleh ditambah..dan trus boleh disimpan dalam table event..


    <?
    $m = (!$m) ? date("m",mktime()) : "$m";
    $y = (!$y) ? date("Y",mktime()) : "$y";

    if ($_SERVER['REQUEST_METHOD'] == "POST")
    {
    $eventdate = $_POST['eventdate'];
    $event = $_POST['event'];
    echo "<br />";

    echo "<h2>PHP Event Calendar</h2>";
    /*echo "This is a demo. We are not saving the event to the calendar, but you could.<br /><br />";
    echo "We are demo-ing building the calendar, and interacting with it.<br /><br />";*/

    echo "<b>Date:</b> $eventdate<br />";
    echo "<b>Event:</b> $event<br />";
    exit();
    }

    ?>
    <html>
    <head>
    <title>PHP Event Calendar</title>
    </head>
    <body bgcolor="#FFFFFF" link="#0000CC" vlink="#0000CC">

    <h2>PHP Event Calendar</h2>

    <blockquote>
    <table>
    <tr>
    <td valign="top"><?php mk_drawCalendar($_GET['m'],$_GET['y']); ?></td>
    <td width="25" nowrap><br /></td>

    <form name="f" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
    <table cellpadding="0" cellspacing="0" border="0" bgcolor="#000000"><tr><td>
    <table cellpadding="4" cellspacing="1" border="0 "bgcolor="#FFFFFF">
    <tr><td colspan="2" bgcolor="#000000"><font size="+1" color="#FFFFFF"><b>Add New Event</b></font></td></tr>
    <tr><td><b>Event Date: </b></td><td><input type="text" name="eventdate" value="" size="12"> <font size="2">mm/dd/yyyy</font></td></tr>
    <tr><td><b>Event:</b></td><td><input type="text" name="event" size="35" maxlength="128"></td></tr>
    <tr><td colspan="2" align="center" bgcolor="#CCCCCC"><input type="submit" value="Add Event"></td></tr>
    </table></td></tr></table></form>

    </td>
    </tr></table>
    </blockquote>
    </body>
    </html>


    <?php

    //************************************************** *******
    // DRAW CALENDAR
    //************************************************** *******
    /*
    Draws out a calendar (in html) of the month/year
    passed to it date passed in format mm-dd-yyyy
    */
    function mk_drawCalendar($m,$y)
    {
    if ((!$m) || (!$y))
    {
    $m = date("m",mktime());
    $y = date("Y",mktime());
    }

    /*== get what weekday the first is on ==*/
    $tmpd = getdate(mktime(0,0,0,$m,1,$y));
    $month = $tmpd["month"];
    $firstwday= $tmpd["wday"];

    $lastday = mk_getLastDayofMonth($m,$y);

    ?>
    <table cellpadding="2" cellspacing="0" border="1">
    <tr><td colspan="7" bgcolor="#CCCCDD">
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr><th width="20">
    <a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?=(($m-1)<1) ? 12 : $m-1 ?>&y=<?=(($m-1)<1) ? $y-1 : $y ?>">&lt;&lt;</a></th>
    <th><font size=2><?="$month $y"?></font></th>
    <th width="20"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?=(($m+1)>12) ? 1 : $m+1 ?>&y=<?=(($m+1)>12) ? $y+1 : $y ?>">&gt;&gt;</a></th>
    </tr></table>
    </td></tr>

    <tr><th width=25 class="tcell">Ahad</th><th width=25 class="tcell">Isnin</th>
    <th width=25 class="tcell"> Selasa</th><th width=25 class="tcell">Rabu</th>
    <th width=25 class="tcell">Khamis</th><th width=25 class="tcell">Jumaat</th>
    <th width=25 class="tcell">Sabtu</th></tr>

    <?php $d = 1;
    $wday = $firstwday;
    $firstweek = true;

    /*== loop through all the days of the month ==*/
    while ( $d <= $lastday)
    {

    /*== set up blank days for first week ==*/
    if ($firstweek) {
    echo "<tr>";
    for ($i=1; $i<=$firstwday; $i++)
    { echo "<td><font size=2>&nbsp;</font></td>"; }
    $firstweek = false;
    }

    /*== Sunday start week with <tr> ==*/
    if ($wday==0) { echo "<tr>"; }

    /*== check for event ==*/
    echo "<td class='tcell'>";
    echo "<a href=\"#\" onClick=\"document.f.eventdate.value='$m-$d-$y';\">$d</a>";
    echo "</td>\n";

    /*== Saturday end week with </tr> ==*/
    if ($wday==6) { echo "</tr>\n"; }

    $wday++;
    $wday = $wday % 7;
    $d++;
    }
    ?>

    </tr></table><p>
    Click on a date to select it and to populate the event date field on the left</p><br />

    <br />

    <?php
    /*== end drawCalendar function ==*/
    }




    /*== get the last day of the month ==*/
    function mk_getLastDayofMonth($mon,$year)
    {
    for ($tday=28; $tday <= 31; $tday++)
    {
    $tdate = getdate(mktime(0,0,0,$mon,$tday,$year));
    if ($tdate["mon"] != $mon)
    { break; }

    }
    $tday--;

    return $tday;
    }

    ?>

  2. #2
    Join Date
    Apr 2004
    Location
    Ampang
    Posts
    18
    Rep Power
    0
    Sorry but the codes seems too messy for me. Anyway, I see that the event field is there. So in order to store it into your DB, simply use the INSERT function.
    ""If you must break the law, do it to seize power: in all other cases observe it." - Julius Caesar

  3. #3
    Join Date
    Sep 2005
    Location
    in my body lar...
    Posts
    1,325
    Rep Power
    0
    Quote Originally Posted by nemia84 View Post
    i really need ur fever guys...
    wah... u need fever meh... cannot give u lar..... if you want fever...
    go to a hospital/klinik and ask the orang sakit there to do you a favour...

    ok... back to your questions... just use the sql insert statement to add it in your database table... just replace the code below with your sql insert statement...
    Quote Originally Posted by nemia84 View Post
    /*echo "This is a demo. We are not saving the event to the calendar, but you could.<br /><br />";
    echo "We are demo-ing building the calendar, and interacting with it.<br /><br />";*/
    if you don't know how to write sql insert statement .... visit w3schools.com to learn it -->>> PHP Tutorial

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Mohon Sumbangan Kos Surgeri Nuur Qistina Hayani
    By nazrol in forum Mamak Stall
    Replies: 0
    Last Post: 11-05-2007, 09:56 PM
  2. Replies: 7
    Last Post: 10-05-2007, 11:36 AM
  3. Peluang Tambah Pendapatan
    By abdull.anur in forum Job Vacancies
    Replies: 3
    Last Post: 05-05-2005, 02:08 PM
  4. camne nak bagi div nie tinggi 100%?
    By b3njo in forum Website Design
    Replies: 1
    Last Post: 01-10-2003, 11:14 PM
  5. Tambah trafik dgn beri free sms
    By zumaidi in forum Other Internet Marketing Methods
    Replies: 7
    Last Post: 05-05-2003, 09:09 AM

Posting Permissions

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

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112