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

📄 modify_input.php

📁 php开发实例完全剖析
💻 PHP
字号:
<?php
//初始化session
session_start();
// 包含数据库连接文件和头文件
require ('dbconnect.php');
include('head.php');

// 必须是管理员登录后,才能管理,如果管理员没有登录,直接退出
// $_SESSION['Adm'] 不能用$Adm变量代替
if(!isset($_SESSION['Adm'])) {
   echo "<p align=center>";
   echo "<font color=#FF0000 size=5><strong><big>";
   echo "管理员还没有登录,请<a href='login.php'>登录</a>!";
   echo "</big></strong></font></p>";
   exit();
}
?>

<html>
    <script language="javascript"> 
    function checkmessage()
    { 			
		if (msgform.title.value=="")
		{
			// 如果主题为空,则显示警告信息
	        alert("主题不能为空!");
			msgform.title.focus();
			return false;
	    }		
		return true;
    }	
    </script>
<?
// 得到上一页的参数
$id=$_GET[id];

?>
<body bgcolor="#FFFFFF" text="#000000">
<h1 ></h1>
<form name="msgform" method="post" action="modify.php"  enctype="multipart/form-data" onsubmit="return checkmessage()">
  <table width="64%" border="0" cellspacing="1" cellpadding="3" bgcolor="#66CCFF" align="center">
  <tr><th >主题</th><th >投票选项</th></tr>
    <?
	// print $firstmesid;
	// 连接数据库表,要回复的文章的获得标题
	$firstsql="select * from title where id='$id'";
	$first_re=mysql_query($firstsql,$conn);
	$first_ar=mysql_fetch_array($first_re);
	$title=$first_ar[title];
	?>
	<tr>
      <td >
        <input type="text" name="title" size="40" value=<? echo $title;?> maxlength="50">
		<!--需要1个隐含input框用来传递titleid参数 -->
		<input type="hidden" name="titleid" value=<?echo $id;?>>
      </td>
	  <?
	  // 获得投票选项
	  $sql="select * from vote where titleid='$id'";
	  $result=mysql_query($sql,$conn);
	  echo "<td><table>";
	  while($choice=mysql_fetch_array($result)){
		  echo "<tr><td><input type='text' name='choice[]' size='40' value=$choice[info] >";
		  // <!--需要1个隐含input框用来传递choiceid参数 -->
		  echo "<input type='hidden' name='choiceid[]' value=$choice[id]>";
	  }
	  ?>
	  <td></td>
    </tr>
    <tr> 
      <td> 
        <div align="right">
          <input type="submit" name="Submit" value="提交">
        </div>
      </td>
      <td> 
        <input type="reset" name="Rewrite" value="重写">
      </td>
    </tr>
  </table>
</form>
</body>
</html>

⌨️ 快捷键说明

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