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

📄 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;
	    }
		if (msgform.content.value=="")
		{
			// 如果留言内容为空,则显示警告信息
	        alert("留言内容不能为空!");
			msgform.content.focus();
			return false;
	    }
		
		return true;

    }	
    </script>
<?
	// 得到上一页的参数
	$firstmesid=$_GET[firstmesid];
	$mesid=$_GET[mesid];
?>
<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">
    <?
	// print $firstmesid;
	// 连接数据库表,要回复的文章的获得标题
	$firstsql="select * from guestbook where MesID='$mesid'";
	$first_re=mysql_query($firstsql,$conn);
	$first_ar=mysql_fetch_array($first_re);
	$title=$first_ar[title];
	$old_content=$first_ar[content];	
	?>		
      <td colspan="2">标 题: 
        <input type="text" name="title" size="60" value=<? echo $title;?> maxlength="50">
		<!--需要两个隐含input框用来传递firstmesid和lastmesid参数 -->
		<input type="hidden" name="firstmesid" value=<?echo $firstmesid;?>>
		<input type="hidden" name="mesid" value=<?echo $mesid;?>>
      </td>
    </tr>
    <tr> 
      <td colspan="2"> 
        <textarea name="content" rows="10" cols="100" >
		  <? echo $old_content;?>
		</textarea>
      </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 + -