<?php include 'yanzheng.php';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
</head>
<body>

<?php require_once 'head.php';?>
<div class="box">


<table width="100%" height="30" border="0" cellpadding="10" cellspacing="0" class="bodernav">
  <tr>
    <td width="122" style="padding-left:10px;">基本信息</td>  
  </tr>
</table>
<form id="myupload" action="" method="post"  enctype="multipart/form-data" >

		 <table width="100%" height="195"  border="0" cellpadding="10" cellspacing="0" class="biaoge">
		 
		   <tr>
			<td width="10%" height="30">请选择栏目</td>
			<td width="90%">
			<select name="typename">
						
						<?php		    						
						$arr=listquery("select * from news_type where fid=0 order by id asc");		
						foreach ($arr as $v) {
						 ?>
						 <option value="<?=$v[typename]?>"><?=$v[typename]?></option>
					   
					   <?php
					   }		  
					   ?>	
					   </select>
			</td>
		  </tr>	
		 
		 
		 
		   <tr>
			<td width="151" height="30">标题</td>
			<td width="726"><input name="title" id="title" type="text"  size="160"  /></td>
		  </tr>	
	
		  
		  
		   <tr>
			<td width="151" height="30">内容</td>
			<td width="726">
			<textarea name="content" id="content" style="height:300px; width:50%;"></textarea>
			</td>
		  </tr>		
		  
		  
		
		   
		   <tr>
			<td height="30"></td>
			<td><input name="submit" type="submit" class="reganniu" value="添加" /></td>
		   </tr>
		</table>

</form>




</div>


<?php require_once 'foot.php';?>

</body>
</html>

<?php
if(isset($_POST['submit'])){

        $typename=$_POST['typename'];
		
  
		 $title=$_POST['title'];		 
		 $content=$_POST['content'];
		 $content=str_replace("'","",$content);
		 $time=date("Y-m-d H:i:s"); 

		 
		$arr=array(	
		'typename'=>$typename,	
		'title'=>$title,
		'content'=>$content,
	    'time'=>$time
		);
		
		$sql=gzsql($arr);		 
		mysql_query("insert into news $sql");
		
        msg('发布成功','news.php');
		
}
?>
