php 将从数据库中得到的值传到另一个页面

<formaction="test.php"method="post"><tablewidth="531"><tr><thwidth="50">姓名:</th><thwi... <form action="test.php" method="post">
<table width="531">
<tr>
<th width="50">姓名:</th>
<th width="144"><?php echo $row["name"]?></th>
<th width="53">性别:</th>
<th width="90"><?php echo $row["sex"]?></th>
<th width="46">年龄:</th>
<th width="120"><?php echo $row["age"]?></th>
</tr>
</table>
<input name="updata" type="submit" value="修改" />
</form>
将 $row["name"],$row["sex"],$row["age"]这三个从数据库中提取的数传到test.php页面中。
希望能写出代码,谢谢啦。
展开
 我来答
殳星阑Bv
2013-08-29 · TA获得超过781个赞
知道小有建树答主
回答量:694
采纳率:50%
帮助的人:402万
展开全部
可以这样:
你要在<form ></form>标签里加个隐藏的表单,如这样:

<table width="531">
<tr>
<th width="50">姓名:</th>
<th width="144"><?php echo $row["name"]?><input type="hidden" name="realname" value="<?=$row["name"]?>" /></th><!--每个里面加上这上一个隐藏的表单,这样你提交之后就可以在另外一个页面获取值了-->
<th width="53">性别:</th>
<th width="90"><?php echo $row["sex"]?></th>
<th width="46">年龄:</th>
<th width="120"><?php echo $row["age"]?></th>
</tr>
</table>
<input name="updata" type="submit" value="修改" />
</form>

在另外一个页面这样获取值:
$name=$_POST['realname']; //这样在test.php页面就取到人名的值了
其他值同理
florida0723
推荐于2016-06-23 · 超过21用户采纳过TA的回答
知道答主
回答量:103
采纳率:0%
帮助的人:32.6万
展开全部
你这个一不传表单值,二没有URL参数传值。怎么实现?
DOM应该这样写:
<input type="text" name="username" value="<?php echo $row["name"]; ?>"/>
提交到text.php页面时,
if($_POST['updata']){
$username=strip_tags($_POST['username']);
…………………………//其他类似
}
print_r($_POST);
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
暴躁的码农
2013-08-29 · 无暴躁,不编程,我爱暴躁,我爱编程
暴躁的码农
采纳数:12 获赞数:20

向TA提问 私信TA
展开全部
<form action="test.php" method="post">
<table width="531">
<tr>
<th width="50">姓名:</th>
<th width="144"><input type="txt" name="name" value="<?php echo $row["name"]?>" /></th>
<th width="53">性别:</th>
<th width="90"><input type="txt" name="sex" value="<?php echo $row["sex"]?>" /></th>
<th width="46">年龄:</th>
<th width="120"><input type="txt" name="age" value="<?php echo $row["age"]?>" /></th>
</tr>
</table>
<input name="updata" type="submit" value="修改" />
</form>

test.php:
<?php
print_r($_POST);
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
jimrontse
2013-08-29 · 超过24用户采纳过TA的回答
知道答主
回答量:117
采纳率:0%
帮助的人:56.9万
展开全部
<?php

$sql = mysql_query("select * from `your_tb_name`");

$row = mysql_fetch_array($sql);

$name = $row["name"];

$sex = $row["sex"];

$age = $row["age"];

header("Location: /test.php?name=".$name."&sex=".$sex."&age=".$age);
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式