 <?php 
   require_once("../head2Alts.php");
   if(isset($_POST['post']) || isset($_POST['submit']))
 {

if(isset($_POST['owniD']) &&  isset($_POST['needid']))
  { 
 $owniD=$_POST['owniD']; 
 $needid=$_POST['needid'];
//////////////////
 $hs=$xcon->getThisMyNeedDetail($ownID,$needid);
  if ($hs->rowCount()>0) {
  
   $hD=$hs->fetch();
 
 
 


  $needid=$hD['needid'];    
   ?>
  <table width="95%" border="0">
    <tr>
    <td colspan="2" align="center">
    
     
        <label id="main_lab" >
         HEXA<font size="6">N</font>DEAL </label>
    </td>
  </tr>
  <tr>
    <td align="left" >
      <ul style="padding-left:0%;">
      <li>
          <form action="hexaNdeal.php" method="post">
          <input class="hi" type="hidden" name="owniD"  value="<?php echo $ownID;?>">

               <input  class="pos" type="submit" value="My Deal Posts" name="post"  >
            </form>
 
      </li>
      <li>
        <form action="hexaNdeal.php" method="post">

               <input class="hi" type="hidden" name="owniD"  value="<?php echo $ownID;?>">

                    <input  class="pos" type="submit" value="My Need Posts" name="post"  >
                 </form>
      </li>
    </ul>
    
    </td>
   
    <td align="right" width="50%">
    <ul>
      <li>
        <form action="dealPostForm.php" method="post">

               <input class="hi" type="hidden" name="owniD"  value="<?php echo $ownID;?>">

                    <input  class="pos" type="submit" value="Have what?" name="post"  >
                 </form>
      </li>
      <li>
        <form action="needPostForm.php" method="post">

               <input class="hi" type="hidden" name="owniD"  value="<?php echo $ownID;?>">

                    <input  class="pos" type="submit" value="Need what?" name="post"  >
                 </form>
      </li>
    </ul>
    
    </td>
  </tr>
 
  <tr>
  <td width="45%" valign="top">
     
    <b> <?php echo $hD['title'] ?> </b><br>
     <small>(Post by:<i><?php echo $hD['cperson']."(".$hD['cphone'].")";?></i></small>
    <small>Posted:<i><?php echo $hD['posteddate']."(status:".$hD['status'].")";?></i></small>
    <small>Category:<i><?php echo $hD['category'];?></i></small>)<br/>
    <b> Description </b><br/>
     <?php echo $hD['description'] ?><br>     
     <small>Location:<i><?php echo $hD['region'].",".$hD['district'].",".$hD['street']."(Deadline:".$hD['deadline'].")";?></i></small>  
 
  </td> 
      
<?php
 
}
 ////////////// 
     
?> 
 
  
 
   <!--NEW USER REGISTRATION FORM, DISPLAYED BY DEFAULTS IN PAGE LOAD-->


 <td  valign="top"> 
<?php
$Of=$xcon->getMyNeedPostPeopleOffer($ownID,$needid); 
if ($Of->rowCount()>0)
  {
    $oN=$Of->fetchAll();
  foreach ($oN as $key => $oF)
  {
   $userID=$oF['senderid'];
   $pF=$con-> getThisUserProfile($userID);
   $fP=$pF->fetch();
    //offerid   needid  senderid  receiverid  description   directory    
     ?> 
   <section>
     <?php
     echo "<b>OFFER FROM: ".$fP['fname']." ".$fP['lname']."(".$fP['phoneno'].")</b><small><i>Posted:".$oF['poston']."</i></small><p/><p/>";
         if ($oF['directory']!="")
           {
            ?>
                  <img src="<?php echo $oF['directory'];?>" style=" width:100%;height:320px; border-radius:12px;"> 
            <?php
          }

     echo "<b>Description</b><p/>".$oF['description']."<p/>";
     echo "<small><i>Location:".$fP['city']."->".$fP['district']."->".$fP['ward']."->".$fP['street'];
     ?>
   </section>
    <?php
     }
  }
?>

</td>
</tr>
</table>
</center>
  <?php

 }
 else
 {
  echo "UNRECOGNISED USER!";
 }
    }
    else{
    echo "ERROR OCCURED!";
  }
 
 
     
        require_once('../footerIns.php');
        ?>





