<?php include('opendb.php'); 
session_start();
?>
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  <title>PSN Telcon</title>
    <script type="text/javascript" src="scripts/jquery-latest.js"></script>
	<link type="text/css" href="includes/style1.css" rel="stylesheet" />
<link href="css/form.css" type="text/css" rel="stylesheet" media="screen" />
    <script type="text/javascript">
        $(function() {
          if ($.browser.msie && $.browser.version.substr(0,1)<7)
          {
			$('li').has('ul').mouseover(function(){
				$(this).children('ul').show();
				}).mouseout(function(){
				$(this).children('ul').hide();
				})
          }
        });        
    </script>
<script>
function del(str,slno)
  {

var r=confirm("Do You Want to delete The News ?");
if (r==true)
  {
 

	if (str=="")
	  {
 	 document.getElementById("msg"+str).innerHTML="";
  	return;
 	 } 
	if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
 	 xmlhttp=new XMLHttpRequest();
 	 }
	else
 	 {// code for IE6, IE5
 	 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
 	 }
	xmlhttp.onreadystatechange=function()
 	 {
  	if (xmlhttp.readyState==4 && xmlhttp.status==200)
   	 {
  	  document.getElementById("msg"+str).innerHTML=xmlhttp.responseText;
   	 }

       }
 xmlhttp.open("GET","news_del.php?q="+str,true);
  xmlhttp.send();

   }

} 


function edit(str)

{

window.open("edit_news.php?id="+str,true,'width=400,height=400');


}

function back()
{
document.location='news_mast.php';

}

</script>
 <meta charset="utf-8" />
    <title>jQuery UI Dialog - Modal message</title>
    <link rel="stylesheet" href="popup/jquery-ui.css" />
     <script src="rightclick_deactive.js"></script>
    <script src="popup/jquery-1.8.2.js"></script>
    <script src="popup/jquery.bgiframe-2.1.2.js"></script>
    <script src="popup/jquery-ui.js"></script>
    <link rel="stylesheet" href="popup/style.css" />
	<script src="datetimepicker_css.js"></script>
    <script>
    $(function() {
        $( "#dialog-message" ).dialog({
            modal: true,
            buttons: {
                Ok: function() {
                    $( this ).dialog( "close" );
                }
            }
        });
    });
    </script>
<script>
function showmsg()
{

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("forms").innerHTML=xmlhttp.responseText;
    document.getElementById('edt_btn').innerHTML="<input type='button' NAME= 'button' VALUE='back' onclick='back()' >";
    }

  }
xmlhttp.open("GET","editnews.php",true);
xmlhttp.send();




}
</script>
<style>
#tbl{
   margin-top:150px;
}
</style>
	

<script src="css3-dropdown-menu-demo_files/bsa.js" async="" type="text/javascript"></script><script async="async" src="css3-dropdown-menu-demo_files/s_a5f348233fceef06ba365ab392938d10.js" id="_bsap_js_a5f348233fceef06ba365ab392938d10" type="text/javascript"></script><style id="bsa_css" type="text/css">.one{position:relative}.one .bsa_it_ad{display:block;padding:15px;border:1px solid #e1e1e1;background:#f9f9f9;font-family:helvetica,arial,sans-serif;line-height:100%;position:relative}.one .bsa_it_ad a{text-decoration:none}.one .bsa_it_ad a:hover{text-decoration:none}.one .bsa_it_ad .bsa_it_t{display:block;font-size:12px;font-weight:bold;color:#212121;line-height:125%;padding:0 0 5px 0}.one .bsa_it_ad .bsa_it_d{display:block;font-size:11px;color:#434343;font-size:12px;line-height:135%}.one .bsa_it_ad .bsa_it_i{float:left;margin:0 15px 10px 0}.one .bsa_it_p{display:block;text-align:right;position:absolute;bottom:10px;right:15px}.one .bsa_it_p a{font-size:10px;color:#666;text-decoration:none}.one .bsa_it_ad .bsa_it_p a:hover{font-style:italic}</style></head>
<body bgcolor="EEEECE">


<?php include('includes/top.php'); ?>
<br>
<table class='container'><tr><td>
<font style="font-family: 'Trebuchet MS',Verdana,Helvetica,sans-serif; font-size:15px;">  &nbsp;&nbsp;Vehicle >> <a href="mast_menu.php" style="text-decoration:none;">Master</a> >> News</font>
<br>
<form>
<table align='right'><tr><td id='edt_btn'><input type='button' NAME= 'button' VALUE='EDIT' onclick="showmsg()" ></td></tr></table>
</form>
<table name='form' align='center'><tr><td id='forms'>
<CENTER>

<FORM ACTION='<?print $PHP_SELF?>' METHOD='POST'>

<table cellspacing=1 cellpadding=1  class='form' >
<tr ><td align=center>
<table>
<tr><td colspan=2 align=center bgcolor='green'><font color='ivory'>NEWS MASTER</font></TD></TR>
<tr><td>Entry Date:</td><td>dd<input type='text' name='d1' value="<? print date('d');?>" size='2'>mm<input type='text' name='m1' value="<? print date('m');?>" size='2'>yy<input type='text' name='y1' value="<? print date('Y');?>" size='4'></td></tr>
<tr><td>Due Date:</td><td> <input type="Text" id="demo2" name = 'due_date' maxlength="25" size="18"/>
     <img src="images/cal.gif" onclick="javascript:NewCssCal ('demo2','yyyyMMdd','dropdown',true,'24',true)"  style="cursor:pointer"/></td></tr>

<tr><td>News:</td><td> <textarea name="news" rows="5" cols="25"></textarea></td></tr>
<TR ><TD COLSPAN=2 ALIGN=CENTER><INPUT TYPE=SUBMIT NAME= 'submit' VALUE='  SAVE  ' ></TD></TR></table>
</form>
</td></tr></table>
<?
if($submit)
{

$entry_dt=$y1."-".$m1."-".$d1;

if($news=="")
{
print "<script> alert('Please Enter News'); history.back(1);  </script>";
     return;
}
else
{
 $sql="insert into news values('','$entry_dt','$due_date','$news','$brcode','$user')";
 mysqli_query($db,$sql) or die(mysqli_error($db));
print "<script> alert('News saved successfully');  </script>";
     return;
}
}
?>

