Click to See Complete Forum and Search --> : time problem


zuzupus
07-24-2003, 08:09 AM
hi,

sorry again for trouble still im getting trouble with time fields for von and bis 2 time fields
1. then i select time from BIS field and click on save then i get bis time in VON field its fine but when i click clock image on bis field to get system and click on save then i,m getting 0:00 i dont no why actually i already discussed this topic and i also get feedback but unfortunately my brain didnt digest this one----that when i chaneg time it works fine but what happen when



<? if (!isset($HTTP_POST_VARS["Save"])) { ?>
<td nowrap align="center">
<select name="von">
<?if( isset($bis) ){
fillDD(0, 0, $bis);
}else{
$mins = date('i');
$mins -= ($mins % 5); fillDD(0, 0, date('H') . ":" . $mins);
} ?>
</select>
<img src="../img/clock.gif" onclick="inputTime();calculateIst()" width="16" height="16" alt="Clock"></td>





<td nowrap align="center">
<select name="bis" onchange="calculateIst()">
<option value="<?=date('H:i')?>"><? echo (date('H:i')); ?></option>
<? fillDD(0, 0, -1); ?>
</select>
<img src="../img/clock.gif" onclick="insertTime();calculateIst()" width="16" height="16" alt="Clock"></td>





2.whn i login second time i m not getting the bis time in von time last entered for eg.
Von Bis
13:21 14:30 // this si fine
13:20 13:21

but when i login im getting system time in Von field instead of 14:30 in Von field in same date i check in database but it only inserts and then select from database




if (isset($HTTP_POST_VARS["bis"]))
{
$von = $HTTP_POST_VARS["von"];
$bis = $HTTP_POST_VARS["bis"];
}
$query = "INSERT INTO t_emp";
$query.="(von,bis) values ";
$query.="('$von','$bis')";
mysql_query($query) or die("Query failed: Insert new row");




please bear with this code as im new bie in this session kind of
things anyone modify this code will really be appreciated or need full code i will send ,hope it is clear

sorry for ur inconvenience

thanks in advance
arun

zuzupus
07-25-2003, 05:54 AM
nobody is there to sort out this problem

zuzupus
07-28-2003, 03:17 AM
sorry for late response i almost solved the problem of 0:00 in von field when clicking on clock image in bis field,but got another problem hope this is easy for u.

what happening when first time i log in it give correct time in von field after form submission for eg.

Von Bis
10:00 10:02 //this is fine when first time i submit the form
9:50 10:00

but next time(second time form submission) when i clcik clock image in bis field and submit form im getting 2 min less in von field for eg.

Von Bis
10:00 10:07// 2 min less as it must be 10:02
10:00 10:02




function fillDD($min, $max, $selected)
{
$sel_bits = explode(":", $selected);
for($i=$min; $i<24; $i++) {
for($j=$max; $j<60; $j+=5) {
$j = sprintf('%02d', $j);
if($i == $sel_bits[0] && $j <= $sel_bits[1] && $j+5 > $sel_bits[1]) {
print("<option SELECTED value='$i:$j'>$i:$j</option>\n");
}
else {
print("<option value='$i:$j'>$i:$j</option>\n");
}
}//for($j)
} //for($i)
}



<td nowrap align="center">
<select name="von">
<?if( isset($von) ){
fillDD(0, 0, $bis);
}else{
//Lets try & select the closest time to now.
$mins = date('i');
fillDD(0, 0, date('H') . ":" . $mins);
} ?>
</select>
<img src="../img/clock.gif" onclick="inputTime();calculateIst()" width="16" height="16" alt="Clock">
</td>

<td nowrap align="center">
<select name="bis" onchange="calculateIst()">
<option value="<?=date('H:i')?>"><? echo (date('H:i')); ?></option>//shows time of server as PHP stuff is there and im using local machine to get value
<? fillDD(0, 0, -1); ?>
</select>
<img src="../img/clock.gif" onclick="insertTime();calculateIst()" width="16" height="16" alt="Clock">
</td>






hopefully u understand this code dont no why it show 2min less in Von field