<?php
require_once("../global/checkuser2.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 rel="stylesheet" href="addmodify.css" />
<script>
function initselect2(){
var vee = document.getElementById("userr").value;
var ste = document.getElementById("user");
for(var i=0;i<ste.options.length;i++){
  if(vee==ste.options[i].value){
       ste.selectedIndex = i;
       break;
  }
}

}
function check(){
var name=document.getElementById("name").value;
var url=document.getElementById("url").value;
var user=document.getElementById("user").value;
var username=document.getElementById("username").value;
var password=document.getElementById("password").value;
if(name==""){
alert("博客名称不能为空");
return false;
}
if(url==""){
alert("博客地址不能为空");
return false;
}
if(user==""){
alert("发布人不能为空");
return false;
}
if(username==""){
alert("帐号不能为空");
return false;
}
if(password==""){
alert("密码不能为空");
return false;
}
}
</script>
</script>
</head>

<body>
<div class="bigdiv">
<div class="toptitle">&nbsp;&nbsp;&nbsp;修改博客<a href="index.php" style="float:right;margin-right:30px;display:inline;">返回</a></div>
<div class="list">
<?php
require_once("../global/connect.php");
$rows=mysql_fetch_array(mysql_query("select * from blog where id=$_GET[id]"));
?>
<input type="hidden" id="userr" value="<?=$rows['user']?>" />
<form action="function.php?mod=modify" method="post" onsubmit="return check()">
<div class="content">
<ul>
<li>博&nbsp;&nbsp;客&nbsp;ID：<input type="text" id="id" name="id" value="<?=$rows['id']?>" readonly="readonly"/></li>
<li>博客名称：<input type="text" id="name" name="name" value="<?=$rows['name']?>" /></li>
<li>博客地址：<input type="text" id="url" name="url" value="<?=$rows['url']?>" style="width:290px;"readonly="readonly" /></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;发布人：<select id="user" name="user">
<option value="">发布人</option>
<?php
			  $rs=mysql_query("select * from user");
			   if($rs){
			   while($row=mysql_fetch_array($rs)){?>
			   <option value="<?=$row['name']?>"><?=$row['name']?></option>
			 <?php }}?>
</select><script>initselect2();</script></li>
<li>帐&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号：<input type="text" id="username" name="username" value="<?=$rows['username']?>" readonly="readonly"/></li>
<li>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：<input type="text" id="password" name="password" value="<?=$rows['password']?>" /></li>
<li style="display:none;">文&nbsp;&nbsp;章&nbsp;&nbsp;数：<input type="text" id="articlenum" name="articlenum" value="<?=$rows['articlenum']?>" readonly="readonly" /></li>
<li style="height:40px;line-height:40px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="提交" class="btn"/></li>
</ul>
</div>
</form>
</div>
</div>
</body>
</html>
