<?php
require_once('../config/config.php');
require_once(CLASS_DIR.'dbClass.php');
$obj = new DBClass();
$cupage = 'news';
$search = $_REQUEST['title'];

if(isset($_POST['submit'])) {
	$sql = "SELECT * FROM ".TBL_NEWS." WHERE title LIKE '%$search%'";
	$rs = $obj->executeQry($sql,$link);
	$rownum = $obj->getrow();
}

require_once(INCLUDES_DIR.ADMHEADER); 
?>
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="29" align="center" class="submenu"><a href="news.php">Manage news</a></td>
    <td align="center" class="submenu"><a href="add_news.php">Add New </a></td>
  </tr>
</table>
<table width="1000" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="17"></td>
  </tr>
  <tr>
    <td><table width="910" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td class="pagehead"><table width="900" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="315" height="35">View Page</td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td valign="top" bgcolor="#FFFFFF" class="innermain"><table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td height="25">&nbsp;</td>
          </tr>
          <tr>
            <td valign="top" class="bdr4"><table width="800" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td bgcolor="#990066" class="form_head">Search News</td>
                </tr>
              <tr>
                <td valign="top" class="form_bg">
                 <form action="" method="post">
					<input type="text" name="title" placeholder="Title of the news" size="50"/>&nbsp;
					<input type="submit" value="Search" id="button_find" name="submit"/>
				</form>
                 </td>
              </tr>
              <tr>
                <td bgcolor="#990066" class="form_head">News Content</td>
              </tr>
              <tr>
                <td valign="top" class="form_bg">
				<?php
						if($obj->getrow()>0) {
							while($row = $obj->fetchrow()) { 
				?>
				<table width="700" border="0" cellpadding="0" cellspacing="0" class="form_txt1">
				
                  <tr>
				  	<td><strong>Date</strong></td>
                    <td><?php echo date("F j, Y",strtotime($row['added_date'])) ?></td>
                    </tr>
					<tr>
				  	<td><strong>Title</strong></td>
                    <td><?php echo $row['title']. ' ( '. $row['id'].' )';?></td>
                    </tr>
					
				  <tr>
				  	<td valign="top"><strong>News</strong></td>
                    <td><div align="justify"><?php echo html_entity_decode(stripslashes($row['news']));?></div></td>
                    </tr>
                </table>
				<p>&nbsp;</p>
				<?php }  } else { ?>Record Not Found<?php } ?>
				</td>
              </tr>
              <tr>
                <td bgcolor="#990066" class="form_head">&nbsp;</td>
              </tr>
              </table></td>
          </tr>
          </table></td>
      </tr>
      </table></td>
  </tr>
  <tr>
    <td height="40">&nbsp;</td>
  </tr>
</table>

<?php require_once(INCLUDES_DIR.ADMFOOTER); ?>