i m selecting year and cohort and when i click search button it will display start date and end date from cohort calander.i want to dispaly the calander on start date and end date.what i do???plz replay me as son as…
[php]
calender.php
<?php include_once "logo.php" ?>
<?php }else{ ?>
Training Center Administration
<?php include_once "login_header.php"; ?>
</div>
<div class="line"></div>
<?php include_once "todays_date.php";?>
Calendar
<?php
if($_POST['submit'] != "" && $_POST['submit'] == "Search")
{
$Year = $_POST['Year'];
$Cohort = $_POST['Cohort'];
$query_calendar_data="SELECT Calendar_id,StartDate,EndDate,Holiday FROM cohartcalendar WHERE Year = '".$Year."' AND Cohort = '".$Cohort."'";
$rs_calendar_data = mysql_query($query_calendar_data);
$count_data = mysql_num_rows($rs_calendar_data);
$Calendar_id = array();
if($count_data >0){ ?>
<div >
<table width="100%" border="1" cellpadding="2" cellspacing="2" style="border-collapse:collapse; ">
<tr >
<th scope="col">Option</th>
<th scope="col">Calendar_id</th>
<th scope="col">Start Date</th>
<th scope="col">End Date</th>
<th scope="col">Holiday</th>
<!-- <th scope="col">Option</th>-->
</tr>
<?php
$sid = 000;
if($row_calendar_data = mysql_fetch_array($rs_calendar_data))
{ $sid++;
?>
<tr>
<td>
<a href="scheduled_edit.php"><input type="button" name="viewcalender" value="viewcalender" /></a>
</td>
<td><input class="inpt" style="width:120px;" type="text" name="StartDate" id="StartDate" value="<?php echo $row_calendar_data['Calendar_id']; ?>"/></td>
<td><input class="inpt" style="width:120px;" type="text" name="StartDate" id="StartDate" value="<?php echo $row_calendar_data['StartDate']; ?>"/></td>
<td class="rep_name"><input class="inpt" style="width:120px;" type="text" name="EndDate" id="EndDate" value="<?php echo $row_calendar_data['EndDate']; ?>"/></td>
<td class="rep_name"><input class="inpt" style="width:120px;" type="text" name="Holiday" id="Holiday" value="<?php echo $row_calendar_data['Holiday'] ?>" /></td>
<!--<td> <a href="datecalender.php" style="color:#FF0000;"> <input type="button" name="createdate" value="Create Date" /> </a></td>-->
</tr> <?php "<td>" ?>
<?php }
?>
No Records Found... |
</div>
<?php
if($_POST['coh_id'] != "")
{ ?>
<div class="cal">
<table width="100%" border="1" cellpadding="2" cellspacing="2" style="border-collapse:collapse;">
<tr>
<th scope="col">Week #</th>
<th scope="col">Monday</th>
<th scope="col">Tuesday</th>
<th scope="col">Wednesday</th>
<th scope="col">Thursday</th>
<th scope="col">Friday</th>
<th scope="col">Saturday</th>
<th scope="col">Sunday</th>
</tr>
<?php
$week_no =1;
$start = $row_coh_details['StartDate'];
$end = $row_coh_details['EndDate'];
$init_date = strtotime($start);
$dst_date = strtotime($end);
$offset = $dst_date-$init_date;
$dates = floor($offset/60/60/24) + 1;
$fdate = explode("/",$row_coh_details['StartDate']);
$ldate = $row_coh_details['EndDate'];
$month = $fdate['0'];
$date = $fdate['1'];
$year = $fdate['2'];
$start_date_day = date("l",mktime(0,0,0,$month,$date,$year));
$DayName = strtolower($start_date_day);
if ($DayName == "monday"){
$colcnt = 1;
$first_line = "";
}
else if ($DayName == "tuesday"){
$colcnt = 2;
$first_line = "<td></td>";
}
else if ($DayName == "wednesday"){
$colcnt = 3;
$first_line = "<td></td><td></td>";
}
else if ($DayName == "thursday")
{
$colcnt = 4;
$first_line = "<td></td><td></td><td></td>";
}
else if ($DayName == "friday")
{
$colcnt = 5;
$first_line = "<td></td><td></td><td></td><td></td>";
}
else if ($DayName == "saturday")
{
$colcnt = 6;
$first_line = "<td></td><td></td><td></td><td></td><td></td>";
}
else if ($DayName == "sunday")
{
$first_line = "<td></td><td></td><td></td><td></td><td></td><td class='num'></td>";
}
// calendar Start
echo '<tr><td>'.$week_no.'</td>'.$first_line;
for ($i = 0; $i < $dates; $i++)
{
$newdate = date("m/d/Y", mktime(12,0,0,date("m", strtotime($start)),
(date("d", strtotime($start)) + $i), date("Y", strtotime($start))));
$curent_date = explode("/",$newdate);
$c_month = $curent_date['0'];
$c_date = $curent_date['1'];
$c_year = $curent_date['2'];
$start_date_day = date("l",mktime(0,0,0,$c_month,$c_date,$c_year));
$DayName = strtolower($start_date_day);
if($DayName == "saturday" || $DayName == "sunday")
{
$class = "num";
}else
{
$class = "";
}
echo '<td class="'.$class.'">'; ?>
<input type="text" name="<?php echo $newdate ?>" id="<?php echo $date_txt ?>" value="<?php echo $newdate; ?>" style="width:90px;" class="inpt hasDatepicker" />
<?php
echo '</td>';
if($DayName == "sunday" && $newdate != $end)
{
$week_no++;
echo '</tr><tr><td>'.$week_no.'</td>';
}
}
?>
</tr>
</table>
</div>
<?php } ?>
<?php } }?>
</form>
</div>
back to calender
if($rs_coursecalendartbl){
$Calendar_id = mysql_insert_id();
}
?>
[/php]