Jump to content

emeralddragon

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

emeralddragon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry but i don't understand your codes :'( .. success : function( resp ) { var $response=$(resp); var reconciled = $response.find('#reconciled_response').html(); I am unclear about function(resp).. so in the form i have to action to reconciled_response.html??.. what about serialize
  2. Thanks Lautarox for the info and this late replies(due to sch work =(.. But i still need your help for the ajax function.. I am a noob =(.. <script > $.ajax({ type: "POST", // you can use POST or GET method depending on how you will be using the vars on php url: "testtest.php", // the url to perform the ajax request data: $("#results"), // the data, as serialize outputs the form data like that, you can use the data outputed by serializing your form success: function(msg){ // what to do with the php output alert( "Data Saved: " + msg ); } }); </script> This is what i put to test in testtest.php, and i not very sure how to get the result of the serialize.. Everytime the testtest.php is load the function will show data saved, with the msg( which is all the codes in dreamweaver) here are the serialize code of mine, <script> function showValues() { var str = $("form").serialize(); $("#results").text(str); } $(":checkbox, :radio").click(showValues); $("select").change(showValues); $("text").change(showValues); showValues(); </script> I need help to able to use $_POST.. Thanks a million =D
  3. Is it possible that once a field text is typed it will auto submit and get the values, cause i would like to like give a summary of the field that have been typed, for example entering 2 dates, i would like to give the day difference in the same page.. The ajax full page reload will auto submit the form??
  4. Hi all, I have recently i have found out a fantastic function in jquery called serialize, which allow form values to show without submitting it.. http://api.jquery.com/serialize/ I wanted to integrate it with php and phpmyadmin, but i couldn't understand the var str = $("form").serialize(); $("#results").text(str); How could I get the value and set it into variables in php??.. using php serialize function? Please help me I'm lost, as I'm fresh to jquery and javascript
  5. Hi all, I have found a calendar that show the event on the calendar, it's great But my project, which is a leave system require a startdate and enddate. The calendar only allow putting the event for a day. Here's the code, <? include ('script/database.php'); $conn = dbConnect(); if (!$conn) die("Could not connect to the database."); function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } $time_start = getmicrotime(); IF(!isset($_GET['year'])){ $_GET['year'] = date("Y"); } IF(!isset($_GET['month'])){ $_GET['month'] = date("n")+1; } $month = addslashes($_GET['month'] - 1); $year = addslashes($_GET['year']); $query = "SELECT Leaveapplies.leaveapplies_id,Leaveapplies.Leave_start_day,User.name, Leaveapplies.Leave_end_day FROM Typeofleave,Leaveapplies,User WHERE Leaveapplies.type_of_leave = Typeofleave.leave_id AND Leaveapplies.login_id = User.login_id AND Leaveapplies.Leave_start_month = '$month' AND Leaveapplies.Leave_start_year ='$year'"; $query_result = mysql_query($query, $conn); while ($info = mysql_fetch_row($query_result)) { $day = $info['1']; $event_id = $info['0']; $events[$day][] = $info['0']; $event_info[$event_id]['0'] = substr($info['2'], 0, 30); } $todays_date = date("j"); $todays_month = date("n"); $days_in_month = date ("t", mktime(0,0,0,$_GET['month'],0,$_GET['year'])); $first_day_of_month = date ("w", mktime(0,0,0,$_GET['month']-1,1,$_GET['year'])); $first_day_of_month = $first_day_of_month + 1; $count_boxes = 0; $days_so_far = 0; IF($_GET['month'] == 13){ $next_month = 2; $next_year = $_GET['year'] + 1; } ELSE { $next_month = $_GET['month'] + 1; $next_year = $_GET['year']; } IF($_GET['month'] == 2){ $prev_month = 13; $prev_year = $_GET['year'] - 1; } ELSE { $prev_month = $_GET['month'] - 1; $prev_year = $_GET['year']; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>PHPCalendar</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="images/cal.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <link href="cal.css" rel="stylesheet" type="text/css"> </head> <body> <div align="center"><strong class="currentdate">Overview of Leave</strong><br><br> <div align="center"><span class="currentdate"><? echo date ("F Y", mktime(0,0,0,$_GET['month']-1,1,$_GET['year'])); ?></span><br> <br> </div> <div align="center"><br> <table width="700" border="0" cellspacing="0" cellpadding="0"> <tr> <td><div align="right"><a href="<? echo "overview1.php?month=$prev_month&year=$prev_year"; ?>"><<</a></div></td> <td width="200"><div align="center"> <select name="month" id="month" onChange="MM_jumpMenu('parent',this,0)"> <? for ($i = 1; $i <= 12; $i++) { $link = $i+1; IF($_GET['month'] == $link){ $selected = "selected"; } ELSE { $selected = ""; } echo "<option value=\"overview1.php?month=$link&year=$_GET[year]\" $selected>" . date ("F", mktime(0,0,0,$i,1,$_GET['year'])) . "</option>\n"; } ?> </select> <select name="year" id="year" onChange="MM_jumpMenu('parent',this,0)"> <? for ($i = 2000; $i <= 2010; $i++) { IF($i == $_GET['year']){ $selected = "selected"; } ELSE { $selected = ""; } echo "<option value=\"overview1.php?month=$_GET[month]&year=$i\" $selected>$i</option>\n"; } ?> </select> </div></td> <td><div align="left"><a href="<? echo "overview1.php?month=$next_month&year=$next_year"; ?>">>></a></div></td> </tr> </table> <br> </div> <table width="700" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#000000"> <tr> <td><table width="100%" border="0" cellpadding="0" cellspacing="1"> <tr class="topdays"> <td><div align="center">Sunday</div></td> <td><div align="center">Monday</div></td> <td><div align="center">Tuesday</div></td> <td><div align="center">Wednesday</div></td> <td><div align="center">Thursday</div></td> <td><div align="center">Friday</div></td> <td><div align="center">Saturday</div></td> </tr> <tr valign="top" bgcolor="#FFFFFF"> <? for ($i = 1; $i <= $first_day_of_month-1; $i++) { $days_so_far = $days_so_far + 1; $count_boxes = $count_boxes + 1; echo "<td width=\"100\" height=\"100\" class=\"beforedayboxes\"></td>\n"; } for ($i = 1; $i <= $days_in_month; $i++) { $days_so_far = $days_so_far + 1; $count_boxes = $count_boxes + 1; IF($_GET['month'] == $todays_month+1){ IF($i == $todays_date){ $class = "highlighteddayboxes"; } ELSE { $class = "dayboxes"; } } ELSE { IF($i == 1){ $class = "highlighteddayboxes"; } ELSE { $class = "dayboxes"; } } echo "<td width=\"100\" height=\"100\" class=\"$class\">\n"; $link_month = $_GET['month'] - 1; echo "<div align=\"right\"><span class=\"toprightnumber\">\n$i</a> </span></div>\n"; IF(isset($events[$i])){ echo "<div align=\"left\"><span class=\"eventinbox\">\n"; while (list($key, $value) = each ($events[$i])) { echo " <a href=\"javascript:MM_openBrWindow('event.php?id=$value','','width=500,height=200');\">" . $event_info[$value]['1'] . " " . $event_info[$value]['0'] . "</a>\n<br>\n"; } echo "</span></div>\n"; } echo "</td>\n"; IF(($count_boxes == 7) AND ($days_so_far != (($first_day_of_month-1) + $days_in_month))){ $count_boxes = 0; echo "</TR><TR valign=\"top\">\n"; } } $extra_boxes = 7 - $count_boxes; for ($i = 1; $i <= $extra_boxes; $i++) { echo "<td width=\"100\" height=\"100\" class=\"afterdayboxes\"></td>\n"; } $time_end = getmicrotime(); $time = round($time_end - $time_start, 3); ?> </tr> </table></td> </tr> </table> </body> </html> I actually tried looping it in the $day using a for loop, it actually don't work. And I realise this way can't work, as there are situation where the startdate could be at end of the month and the enddate on the next month. Hope you guys can help me Thks
  6. Hi all, i need some help in retaining the values in an <option> textbox.. I have found a code to loop the date online, and use it for Javascript jump menu, but i have no ideas how to retain the option.. here are my codes(in red), $year1 = date('Y'); $month1 = date('m'); $day1 = date('j'); $day1 = $day1 + 1; $year2 = date('Y') + 2; $month2 = date('m'); $day2 = date('j'); $start_date = "$year1-$month1-$day1"; $end_date = "$year2-$month2-$day2"; $date = mktime(0,0,0,$month1,$day1,$year1); //Gets Unix timestamp START DATE $date1 = mktime(0,0,0,$month2,$day2,$year2); //Gets Unix timestamp END DATE $difference = $date1-$date; //Calcuates Difference $daysago = floor($difference /60/60/24); //Calculates Days Old $i = 0; while ($i <= $daysago +1) { if ($i != 0) { $date = $date + 86400; } else { $date = $date - 86400; } $yy1 = date('Y',$date); $mm1 = date('m',$date); $dd1 = date('d',$date); $date3 = "$yy1-$mm1-$dd1" ; echo "<option value=\"test1234.php?m=$mm1&y=$yy1&d=$dd1\" "; echo ">".$date3 ."</option>"; $i++; } i know that i have to something selected, but i dun understand how this set of date code loop which left me helpless.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.