简体   繁体   中英

How to pass multiple parameters in a URL in php?

I want to pass multiple parameters to a URL using post method. I created a form wherein the user could enter the values and submit the form and then it opens a new page where the URL is displayed to be clicked to process the transaction with the given parameters.

Here, I'm unable to finish this task. I don't know where I'm doing the mistake, but the URL is not getting correctly.

Kindly help me fix this issue please. 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>

There is nothing wrong with the code. The only issues are 1. Missed double quotes in the URL (now corrected). 2. By mistake, tested the code on normal web browser on the local machine instead of doing it on the server.

That's all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM