<?php
$PageSecurity = 2;
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');
 
   $q=$_GET['q'];
   
   
     $i=$_GET['i'];
$shift_for=$_REQUEST['shift_for'];
 // "select * from shift_master where id='".$q."' and site='".$_REQUEST['AttSite']."' and shift_for='".$shift_for."'";
  $get_shift=DB_query("select * from shift_master where id='".$q."' and site='".$_REQUEST['AttSite']."' and shift_for='".$shift_for."'",$db);
	  $get_res=DB_fetch_array($get_shift);
   	  $_REQUEST['shift_start']=$get_res['shift_start'];
	  $_REQUEST['shiftstart_AMPM']=$get_res['start_AMPM'];
	  $_REQUEST['shift_end']=$get_res['shift_end'];
	   $_REQUEST['shiftend_AMPM']=$get_res['end_AMPM'];
	  $_REQUEST['time_in'][$i]=$get_res['shift_start'];
	  $_REQUEST['timein_AMPM'][$i]=$get_res['start_AMPM'];
	  $_REQUEST['time_out'][$i]=$get_res['shift_end'];
	  if($get_res['end_AMPM']!='')
	  $_REQUEST['timeout_AMPM'][$i]=$get_res['end_AMPM'];
	  else
	  	$_REQUEST['timeout_AMPM'][$i]='PM';

?><table width="100%" border="0">
  <tr>
    <td width="50%">
    <input name="shift_start[<?php echo $i;?>]" type="text" id="shift_start_<?php echo $i;?>" value="<?php echo $_REQUEST['shift_start'];?>" size="3" /><select name="shiftstart_AMPM[<?php echo $i;?>]" id="shiftstart_AMPM_<?php echo $i;?>" style="width:40px;" >
      <option value="AM"<?php echo ($_REQUEST['shiftstart_AMPM']=='AM'?'selected':'')?>>AM</option>
      <option value="PM"<?php echo ($_REQUEST['shiftstart_AMPM']=='PM'?'selected':'')?>>PM</option>
    </select></td>
     <td width="50%">
<input name="shift_end[<?php echo $i;?>]" type="text" id="shift_end_<?php echo $i;?>" value="<?php echo $_REQUEST['shift_end'];?>" size="3" />
<?php  //echo $setAMPM= $_REQUEST['shiftend_AMPM'];?>
   <select name="shiftend_AMPM[<?php echo $i;?>]" id="shiftend_AMPM_<?php echo $i;?>" style="width:40px;"   >
	  <option value="AM"<?php echo ($_REQUEST['shiftend_AMPM']=='AM'?'selected':'')?>>AM</option>
	  <option value="PM"<?php echo ($_REQUEST['shiftend_AMPM']=='PM'?'selected':'')?>>PM</option>
	  </select>	 </td>
  </tr>
</table>
