php - 如何选择一个表的两列或多列并通过GET/POST发送?

标签 php html mysql radio-button html-table

我有一个使用 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/

相关文章:

php - 使用 PHP 获取文件扩展名的最短方法

php - 将 WooCommerce Review 内容放入产品摘要

html - 尽管分配了百分比宽度,IMG 仍生成滚动条

javascript - 如何让Div中的所有链接在同一个窗口中打开

HTML CSS 如何在嵌套列表中的每个 li 下划线

javascript - PHP 循环中的表行总和

php - 仅当字段中的值等于或大于输入值时,如何从 MySQL 表中的值中减去用户输入值?

php - 将html内容保存到mysql数据库中

mysql - JPA/Hibernate 中查询返回 null,但 mysql 中不返回 null

php - 无法使用 PHP 7.2 从 MySQL 数据库中选择数据