⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 add.php

📁 一个投票系统
💻 PHP
字号:
<?
include("const.php");
if (!(session_is_registered("admins")))
{
   echo "<script language='javascript'>alert('?ú?1??óDμ???!');window.location.href='admin.php';</script>";
   exit;
}
else
{
   top("添加投票主题");
   top1("请在下面添加投票主题:");
   if ($HTTP_POST_VARS["actions"]=="1")
   {
      $titles=trim($HTTP_POST_VARS["titles"]);
	  $choice=trim($HTTP_POST_VARS["choice"]);
	  if (empty($titles))
	  {
	     echo "<script language='javascript'>alert('主题不能为空!');window.location.href='add.php';</script>";
		 exit;
	  }
	  else
	  {
	     if ($choice=="1")
		    $ch="a";
		 else
		    $ch="b";
	     link_data();
		 $query="insert into title(title,choice) values('".$titles."','".$ch."')";
		 $result=mysql_query($query);
		 echo "<script language='javascript'>alert('主题添加成功!');window.location.href='add.php';</script>";
	  }
	}

?>
<form name="form1" method="post" action="">
  <table width="70%"  border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#000000">
    <tr>
      <td width="26%" height="14" bgcolor="#CCCCCC"><div align="center">标题内容</div></td>
      <td width="74%" bgcolor="#FFFFFF"><textarea name="titles" cols="30" rows="4" id="titles"></textarea>
      小于200字符</td>
    </tr>
    <tr>
      <td width="26%" height="7" bgcolor="#CCCCCC"><div align="center">单选/多选</div></td>
      <td bgcolor="#FFFFFF"><input name="choice" type="radio" value="1" checked>
        单选
          <input type="radio" name="choice" value="2">
      多选</td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td colspan="2"><div align="center">
          <input name="actions" type="hidden" id="actions" value="1">
          <input type="submit" name="Submit" value="提交">
&nbsp;&nbsp;
          <input type="reset" name="Submit2" value="重置">
      </div></td>
    </tr>
  </table>
</form>
<br><br><br><br><br>
<?
bottom();
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -