Current File : /home/inlingua/public_html/noida/icentex_noida/timesheet.php |
<?php
include("header.php");
?>
<?php
$month=date("m");
$year=date("Y");
//$year=2011;
?>
<h3> Add New Timesheet</h3>
<script>
function validate(form)
{ if (document.form.month.value=="")
{ alert("Please Select month.");
document.form.month.focus(); return false;
}
if (document.form.year.value=="")
{ alert("Please Select Year.");
document.form.year.focus(); return false;
}
if (document.form.location.value=="")
{ alert("Please Select Location.");
document.form.location.focus(); return false;
}
return true;
}
function validate1(form)
{ if (document.form1.month.value=="")
{ alert("Please Select month.");
document.form1.month.focus(); return false;
}
if (document.form1.year.value=="")
{ alert("Please Select Year.");
document.form1.year.focus(); return false;
}
if (document.form1.location.value=="")
{ alert("Please Select Location.");
document.form1.location.focus(); return false;
}
return true;
}
</script>
<font style="font-size:12px; color:#E84B1E"><?php if($_SESSION['existsheet']) { echo $_SESSION['existsheet']; unset ($_SESSION['existsheet']); }?></font>
<table width="100%">
<tr><td width='23%'>
<form action="timesheet.main.php" method="post" name="form" onsubmit=" return validate(this)">
Enter First Half of</td><td> <select name='month'>
<option value="">Select Month</option>
<option value="01" <?php if($month=='01') echo"selected"; ?>>Jan</option>
<option value="02" <?php if($month=='02') echo"selected"; ?>>Feb</option>
<option value="03" <?php if($month=='03') echo"selected"; ?>>Mar</option>
<option value="04" <?php if($month=='04') echo"selected"; ?>>Apr</option>
<option value="05" <?php if($month=='05') echo"selected"; ?>>May</option>
<option value="06" <?php if($month=='06') echo"selected"; ?>>Jun</option>
<option value="07" <?php if($month=='07') echo"selected"; ?>>Jul</option>
<option value="08" <?php if($month=='08') echo"selected"; ?>>Aug</option>
<option value="09" <?php if($month=='09') echo"selected"; ?>>Sep</option>
<option value="10" <?php if($month=='10') echo"selected"; ?>>Oct</option>
<option value="11" <?php if($month=='11') echo"selected"; ?>>Nov</option>
<option value="12" <?php if($month=='12') echo"selected"; ?>>Dec</option>
</select>
of
<select name='year'>
<?php
$newyaer=date('Y');
for($j=2010;$j<=$newyaer;$j++)
{
echo"<option value='".$j."' ";
if($j==$year)
{
echo"selected";
}
echo">".$j."</option>";
}
?>
</select>
for
<select name='location'>
<option value="">Select Location</option>
<?php
$querylocation="select primarycenter from timesheet_user where recNo='".$_SESSION['id']."'";
$resultlocation=mysql_query($querylocation) or die(mysql_error());
$numlocation=mysql_fetch_array($resultlocation);
$queryloc="select * from timesheet_location";
$resultloc=mysql_query($queryloc) or die(mysql_error());
while ($numloc=mysql_fetch_array($resultloc))
{
echo"<option value='".$numloc[location]."' ";
if($numlocation[primarycenter]==$numloc[location])
{
echo"selected";
}
echo">".$numloc[location]."</option>";
}
?>
</select>
<input type='hidden' name='half' value="1">
<input type='submit' class="submit1" value=" Next ">
</form>
</td></tr>
<tr><td align="center"> OR </td></tr>
<tr> <td>
<form action="timesheet.main.php" method="post" name="form1" onsubmit=" return validate1(this)">
Enter Second Half of
</td><td>
<select name='month'>
<option value="">Select Month</option>
<option value="01" <?php if($month=='01') echo"selected"; ?>>Jan</option>
<option value="02" <?php if($month=='02') echo"selected"; ?>>Feb</option>
<option value="03" <?php if($month=='03') echo"selected"; ?>>Mar</option>
<option value="04" <?php if($month=='04') echo"selected"; ?>>Apr</option>
<option value="05" <?php if($month=='05') echo"selected"; ?>>May</option>
<option value="06" <?php if($month=='06') echo"selected"; ?>>Jun</option>
<option value="07" <?php if($month=='07') echo"selected"; ?>>Jul</option>
<option value="08" <?php if($month=='08') echo"selected"; ?>>Aug</option>
<option value="09" <?php if($month=='09') echo"selected"; ?>>Sep</option>
<option value="10" <?php if($month=='10') echo"selected"; ?>>Oct</option>
<option value="11" <?php if($month=='11') echo"selected"; ?>>Nov</option>
<option value="12" <?php if($month=='12') echo"selected"; ?>>Dec</option>
</select>
of
<select name='year'>
<?php
for($j=2010;$j<=$newyaer;$j++)
{
echo"<option value='".$j."' ";
if($j==$year)
{
echo"selected";
}
echo">".$j."</option>";
}
?>
</select>
for
<select name='location'>
<option value="">Select Location</option>
<?php
$querylocation="select primarycenter from timesheet_user where recNo='".$_SESSION['id']."'";
$resultlocation=mysql_query($querylocation) or die(mysql_error());
$numlocation=mysql_fetch_array($resultlocation);
$queryloc="select * from timesheet_location";
$resultloc=mysql_query($queryloc) or die(mysql_error());
while ($numloc=mysql_fetch_array($resultloc))
{
echo"<option value='".$numloc[location]."' ";
if($numlocation[primarycenter]==$numloc[location])
{
echo"selected";
}
echo">".$numloc[location]."</option>";
}
?>
</select>
<input type='hidden' name='half' value="2">
<input type='submit' class="submit1" value=" Next ">
</form>
</td></tr>
</table>
<?php
include("footer.php");
?>