<?php
session_start();
include './connection.php';
 if(empty($_SESSION["user_id"])||$_SESSION["Logdin"]===false||empty($_SESSION["court_id"]))
{
    header("Location:login.php");
    exit();
}
?>
 
<h2 style="text-align: center;">Proceedings of Selected Date:</h2>
<form action="./updateproc.php " method="GET">


<table style="width: 90%;text-align: center;border:1px solid navy;margin-left: 50px;">
	<tr style="background-color: navy;color: white;">
		<th>  مقدمہ/علت نمبر  </th>
		<th>رجوعہ</th>
		<th>عنوان مقدمہ</th>
        <th>موجودہ پیشی</th>
         <th>موجودہ کاروائی</th>
		<th>  نئی کاروائی  </th>
<th>نئی تاریخ</th>
               		<th>Update</th>
               			<th>Delete</th>
	</tr>
<?php

$date=date("d/m/Y",strtotime($_POST["cdate"]));

$q1="SELECT * FROM caseproceedings WHERE pcourtid='".$_SESSION["court_id"]."' AND proceedingdate='".$date."' ";
   $result=$conn->query($q1);
    if (!empty($result) && $result->num_rows > 0)
     {
 
while( $row1=$result->fetch_assoc())
{
      echo '<input name="caseid" type="hidden" value="'.$row1["caseid"].'">';
      echo '<input name="q" type="hidden" value="1">';
  
	$q11="Select * from caseinfo Where ID='".$row1["caseid"]."' AND currentcourtid='".$_SESSION["court_id"]."'";
    $result1=$conn->query($q11);
    if (!empty($result1) && $result1->num_rows > 0)
     {
     	$row=$result1->fetch_assoc();
     	echo "<tr>";

echo '<td name="caseno">'.$row["caseno"].'</td>';
echo '<td>'.$row["instdate"].'</td>';
echo '<td>'.$row["casetitle"].'</td>';

echo '<td>'.$row1["proceedingdate"].'</td>';
echo '<td>'.$row1["proceeding"].'</td>';
//echo '<td ><input type="date" name="nextdate" style=" padding_top=4px;"></td>';

echo '<td>';
?>
<select name="proceed"  class="txt"> <?php

$q2="Select * from courtproceedings";
    $result1=$conn->query($q2);
    if (!empty($result1) && $result1->num_rows > 0)
     {

while( $row11=$result1->fetch_assoc())
{
    echo '<option value="';echo $row11["proceedingtitle"];echo '">';echo $row11["proceedingtitle"]; echo '</option>';
}
     }

        
echo '</select>';

echo '</td><td><input name="nextdate" type="text" value="'.$row1["proceedingdate"].'"></td><td><button style="color:darkgreen;" border-radius: 7px; >Update</button></td><td><a href="./prodelete.php?id='.$row1["ID"].'">Delete</a></td></tr>';
   
     }
    
}
     }

?>

<style type="text/css">
     tr{
    font-family: jameel noori nastaleeq;
}
      table,   td {
  border: 1px solid black;
  border-collapse: collapse;
        }
th  {
  border: 1px solid black;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 18px;
}

 </style>