红色的就是要传递的值,代码如下:
bbs_add_affiche.php的代码
<?php 
session_start();
if($_SESSION["admin_user"]==""){
  echo "<script>alert('禁止非法登录!');window.location.href='admin_user.php';</script>";
  exit;
 }else{
?>
<!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=gb2312" />
<title>添加公告</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: 12px;
color: #0099CC;
}
-->
</style>
<link href="css/font.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE2 {font-size: 20px;
font-weight: bold;
}
-->
</style>
</head><body>
<form id="form1" name="form1" method="post" action="bbs_add_affiche_ok.php">
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="32" background="images/right_line.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;您现在的位置:校园馨浪网站后台管理系统 &gt; 公告管理 &gt; 添加公告</td>
  </tr>
  <tr>
    <td height="32" background="images/right_top.gif">&nbsp;</td>
  </tr>
  <tr>
    <td height="488" align="center" valign="top" background="images/right_middle.gif"><table width="300" height="40">
      <tr>
        <td height="40" background="images/biaoti.gif"><div align="center"><span class="STYLE2">添加公告</span></div></td>
      </tr>
      <tr>
        <td height="30">&nbsp;</td>
      </tr>
    </table>
      <table width="559" height="264" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="45" align="right"><span class="STYLE3">公告类别:&nbsp;&nbsp;</span></td>
          <td>
    <div align="left">
      <select name="lt_affiche_type" id="lt_affiche_type">
          <option selected="selected">请选择公告类别</option>
      <?php
              include_once("conn/conn.php");
 $query=mysql_query("select * from lt_big_type ");
             while($myrow=mysql_fetch_array($query)){
              ?>
        <option value="<?php echo $myrow[lt_big_type_content];?>"><?php echo $myrow[lt_big_type_content];?></option>
        <?php }?>
          </select>
      <input name="lt_affiche_user" type="hidden" id="lt_affiche_user" value="<?php echo $admin_user;?>" />         </div></td>
        </tr>
        <tr>
          <td width="106" height="36" align="right"><span class="STYLE3">公告标题:&nbsp;</span></td>
          <td width="415"><div align="left">
            <input name="lt_affiche_subject" type="text" id="lt_affiche_subject" size="50" />
          </div></td>
        </tr>
        <tr>
          <td height="149" align="right"><span class="STYLE3">公告内容:&nbsp;&nbsp;</span></td>
          <td><div align="left">
            <textarea name="lt_affiche_content" cols="50" rows="10" id="lt_affiche_content"></textarea>
          </div></td>
        </tr>
        <tr>
          <td height="34" align="right">&nbsp;</td>
          <td><input type="submit" name="Submit" value="提交" />
              <input type="reset" name="Submit2" value="重置" /></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td height="32" background="images/right_bottom.gif">&nbsp;</td>
  </tr>
  
</table></form>
</body>
</html>
<?php }?>bbs_add_affiche_ok.php的代码
<?php 
session_start();
if($_SESSION["admin_user"]==""){
  echo "<script>alert('禁止非法登录!');window.location.href='admin_user.php';</script>";
  exit;
 }else{
?>
<?php
include("conn/conn.php");   $date=date("Y-m-j H:s:i");
   if(isset($_POST['Submit'])  && $_POST['lt_affiche_type']!=null && $_POST['lt_affiche_subject']!=null && $_POST['lt_affiche_content']!=null )
   { 
       $insert=mysql_query("insert into lt_affiche(lt_affiche_type,lt_affiche_subject,lt_affiche_content,lt_affiche_user,lt_affiche_date) values('".$_POST['lt_affiche_type']."','".$_POST['lt_affiche_subject']."','".$_POST['lt_affiche_content']."','".$_POST['lt_affiche_user']."','".$date."')");
   if($insert)
   {
      echo "<script> alert('公告添加成功!'); window.location.href='bbs_send_affiche.php'</script>";
   }
   else
   {
      echo "<script> alert('公告添加失败!'); window.location.href='bbs_send_affiche.php'</script>";
   }
   }
   else if(isset($_POST['Submit2']))
  {
     echo "<script> alert('取消成功!'); window.location.href='bbs_send_affiche.php'</script>";
  }
?>
<?php }?>