如何通过表单上的“提交"按钮传递参数 [英] How can I pass a parameter with submit button on form

查看:66
本文介绍了如何通过表单上的“提交"按钮传递参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个from,它可以更改PHP制作的mySQL中的产品数据.
而且我有一个关键列,它会自动递增并指定每个产品.当我单击以编辑产品链接时,它将传递我从每个产品获得的键值并链接到editPage.php

I want to create the from that can change product data in mySQL made by PHP.
and I have the key column that auto increment and specify each product. When i click to edit product link .it will pass the key values that i get from each product and link to editPage.php

$Key = $data['Key']; 
<a href=\"editPage.php?Key=".$Key."\">edit</a>

在editPage.php中,我从上一页获取键值,并希望使用提交表单"按钮将此值传递到下一页.我在操作链接中附加了键值.

in editPage.php i get the key values from previous page and i want pass thisvalues to next page with submit form button.I attach Key values in action link.

<?$Key = $_GET["Key"];?>
<form id="form2" name="form1" method="post" action="editWeb.php?Key=".$Key." \">

它不起作用,是否可以通过其他方式传递键值.告诉我您是否需要更多信息谢谢!! :))

It don't work, Can I pass Key values with another ways. Tell me if you want more information Thanks!!:))

推荐答案

您需要回显该值.

<form id="form2" name="form1" method="post" action="editWeb.php?Key=<? echo $Key ?>"/>

您还可以使用隐藏的输入:

You could also use a hidden input:

<form id="form2" name="form1" method="post" action="editWeb.php"/>
<input type="hidden" name="Key" value="<? echo $Key ?>" />

这篇关于如何通过表单上的“提交"按钮传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆