如何在PHP中的URL中传递多个参数?

时间:2016-07-05 17:29:54

标签: php html

我想使用post方法将多个参数传递给URL。我创建了一个表单,其中用户可以输入值并提交表单,然后打开一个新页面,其中显示URL以单击以使用给定参数处理事务。

在这里,我无法完成此任务。我不知道我在哪里犯了这个错误,但网址没有正确显示。

请帮我解决这个问题。 的test.html

<html>
<body>
<form action="Test.php" method="POST">
Mobile Number: <input type="text" name="mNum"><br>
Recepient ID: <input type="text" name="resID"><br>
Bank A/c Number: <input type="text" name="acNum"><br>
Amount: <input type="text" name="amt"><br>
<input type="submit">
</form>
</body>
</html>

test.php的

<html>
<body>
Confirm?<br><br>
<a href="http://example.com/money-api/transaction-now?api_token=3e5R4a9U6T7TfypoNvqKv&mobile_number=<?php echo $_POST["mNum"]; ?>&receipient_id=<?php echo $_POST["resID"]; ?>&bank_account=<?php echo $_POST["acNum"]; ?>&amount=<?php echo $_POST["amt"]; ?>&channel=1&client_id=11221106">CONFIRM</a>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

代码没有问题。唯一的问题是 1.错过了URL中的双引号(现已更正)。 2.错误地,在本地计算机上的普通Web浏览器上测试代码,而不是在服务器上进行测试。

就是这样。

相关问题