自己的做的简单留言板,修改资料出问题了!

pengboy 2009-08-20 08:49:45
最近新学了PHP,自己动手做了一个简单的留言,在修改资料的时候,出现了一个问题
修改页面如下:
<?php
include("conn.php");
include("head.php");

if($_POST[hide])
{
$eid=$_POST[hide];
echo $eid; ////////////////这个地方接受不到ID的值,总是显示为1
}

$lid=$_GET[id];
$sql="select * from lyb where id=".$lid."";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
?>
<br>
<form action="" method="post" name="frm" id="frm">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="91" height="30" align="right">留言标题:</td>
<td width="509"><label>
<input name="title" type="text" id="title" value="<? echo $row[title]?>" />
<input name="hide" type="text" id="hide" value="<? echo $row[id]?>" />
</label></td>
</tr>
<tr>
<td height="30" align="right">留言内容:</td>
<td><label>
<textarea name="content" id="content" cols="45" rows="5"><? echo $row[content]?>
</textarea>
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="button" id="button" value="修改" />
<input name="hide" type="hidden" id="hide" value="1" />
</label></td>
</tr>
</table>
</form>
...全文
123 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
ablewell 2009-08-21
  • 打赏
  • 举报
回复
学习中…………
zhuhuquan29 2009-08-20
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 dzxccsu 的回复:]
晕,你有两个name为hide,程序自动取最后一个,也就是你规定value="1"那个。
试试:
PHP code$_POST['hide'][0];
[/Quote]
正结 楼主写表单的名字的时候不能重复的呵呵为什么是1???
因为你在写表单名字的时候名字重复了而PHP接受的时候他会接收最后面HIDE的直哦不能那么说而是在HTML传参的时候第2个HIDE把第一个HIDE直给覆盖了呵呵这样说明白??OK?
dzxccsu 2009-08-20
  • 打赏
  • 举报
回复
晕,你有两个name为hide,程序自动取最后一个,也就是你规定value="1"那个。
试试:

$_POST['hide'][0];
dzxccsu 2009-08-20
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 pengboy 的回复:]
我并没有规定为1 呀?
[/Quote]看红色,value="1"那么hide值永远是1
阿_布 2009-08-20
  • 打赏
  • 举报
回复

$_POST["hide"]);加上""号试试。
pengboy 2009-08-20
  • 打赏
  • 举报
回复
我并没有规定为1 呀?
ldyanstar 2009-08-20
  • 打赏
  • 举报
回复
同意楼上的!
pengboy 2009-08-20
  • 打赏
  • 举报
回复
不是吧,<input name="hide" type="hidden" id="hide"/>我把类型,该为TEXT的,显示为5呀
dzxccsu 2009-08-20
  • 打赏
  • 举报
回复
<input name="hide" type="hidden" id="hide" value="1" /> 你已经规定为1了,当然是1
x1987xiaoxiao 2009-08-20
  • 打赏
  • 举报
回复
你俩个hidden的名字不要取一样的么
总哈哈 2009-08-20
  • 打赏
  • 举报
回复
强人编程,把 <input name="hide" type="hidden" id="hide" value="1" /> 去掉就可以了
itaoo 2009-08-20
  • 打赏
  • 举报
回复
if($_POST[hide])
xsir317 2009-08-20
  • 打赏
  • 举报
回复
大哥。。。你命名的时候能不能有点谱?

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧