0

i have this date format 04:00 and I want to echo it to two drop down boxes, 04 for the first box and 00 for the second box by clicking the Edit button. The value 04:00 had been already display in the form page and I want it to be display on drop down boxes.

my code is this..

<?php
        $_sql="SELECT  day, daydesc, room, starttime, wsid, endtime, location, locationname, roomname FROM 
weeklyeventscheddesc  WHERE weeklyeventscheddesc.weid=".@$_GET["weid"];
}
$data = $vdb->SelectAll($_sql);
foreach ($data as $s_row)
{
$wsid= $s_row['wsid'];
$room=$s_row['room'];
$day= $s_row['day'];
$location= $s_row['location'];
/* starttime==04:00   this would be the value */

                    ?>
                    <tr>
                      <td><?php
echo $s_row['daydesc'] ." ". $s_row['starttime']. " ".  "-". " ".  $s_row['endtime']. " ". "&nbsp; ". "&nbsp ". "&nbsp ".  $s_row['locationname']. "&nbsp ". "&nbsp ".  $s_row['roomname'];?>
                      <td align="right"><input type="submit" name="Edit" value="Edit" id="Edit2" onclick="SelectThisSched('EditSchedule','<?php echo $wsid; ?>','<?php echo $room;?>', '<?php echo $day;?>', '<?php echo $location;?>');ShowHideAdd('EditSchedule','block')" 
 /></td>
                    </td>

                    </tr>

                    <?php } ?>

and this is the javascript code

function SelectThisSched(div, wsid, room, day, location)
{
var x=0;
var s;

    if (document.getElementById) {
        x = document.getElementById(div);
        if (x) 
            x.style.display = 'block';
        x = document.getElementById('wsid');
        if (x) 
            x.value = wsid;
            x = document.getElementById('room');
        if (x) 
            x.value = room;
            x = document.getElementById('day');
        if (x) 
            x.value = day;
            x = document.getElementById('location');
        if (x) 
            x.value = location;
        x = document.getElementById('eActve');
        if (x) 
            x.value = actve;
    }   
}

Please Help me bout my problem!!

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by diafol
0
$hrs = substr($starttime,0,2);
$mins = substr($starttime,3,2);

or you could use explode:

$bits = explode(':',$starttime);

This would put your hrs into $bits[0] and mins into $bits[1]. This is probably the safest out of the two methods.

There are fancy little time functions you could fuss with, but I wouldn't bother.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.