我有一个使用 Mysql 和 PHP 生成的简单 HTML 表格。
我想选择我的表格的一行,并通过 GET 或 POST 将两个或更多内容发送到另一个页面,使用尽可能简单的方法。
今天,我只能使用这样的“单选”按钮发送一个参数:
<form method="GET" action="table.php">
<table>
<?php
$query="SELECT * from prices ORDER BY region limit 10";
$result=mysql_query($query,$connection);
while ($linha = mysql_fetch_array($result)) {
?>
<tbody>
<tr>
<td><input type="radio" name="region" value="<?php echo $linha['region'] ?>" /></td>
<td><?php echo $row['type']; ?></td>
<td><?php echo $row['region']; ?></td>
<td><?php echo $row['platform']; ?></td>
<td><?php echo $row['price']; ?></td>
</tr>
</tbody>
<?php
}
?>
</table>
<input type="submit" value="Submit"/>
</form>
所以,如果我点击“提交”按钮,我会得到:
table.php?region=ap-northeast-1
如何获取,例如:
tabela.php?region=ap-northeast-1&type=c1.medium
=== 编辑:
这就是我的 table 的样子:
type region platform price $/h
m3.xlarge ap-northeast-1 windows 0.980
hs1.8xlarge ap-northeast-1 rhel 5.810
hi1.4xlarge ap-northeast-1 rhel 3.960
m1.medium ap-northeast-1 windows 0.230
cg1.4xlarge ap-northeast-1 rhel 4.450
cc2.8xlarge ap-northeast-1 rhel 3.100
c1.xlarge ap-northeast-1 rhel 0.855
c1.medium ap-northeast-1 rhel 0.254
m2.4xlarge ap-northeast-1 rhel 2.135
m2.2xlarge ap-northeast-1 rhel 1.079
我希望能够将值“type”AND“platform”发送到另一个页面:)
最佳答案
你可以为类型使用隐藏域
<input type="hidden" name="type" value="<?php echo $row['type']; ?>" />
关于php - 如何选择一个表的两列或多列并通过GET/POST发送?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19731675/