Reputation: 1243
I am using the PHP QR code library from 'http://phpqrcode.sourceforge.net/'. It is working when using 1 parameter, however when I add an additional parameter it is not generating a QR code at all. My code is as follows -
<?php
// generateQR.php
include('C:\xampp\htdocs\phpqrcode\qrlib.php');
$param = $_GET['address'];
$param2 = $_GET['amount'];
QRcode::png("bitcoin:".$param."?amount=".$param2);
?>
and main class below
echo '<img src="generateQR.php?address='.$newOrderaddress.'?amount='.$order_amountbtc.'"/>';
There are no errors thrown, it is simply not outputting a QR code using the above. If I only pass 1 variable, it is working.
Upvotes: 0
Views: 1353
Reputation: 912
Your URL is malformed.
When sending multiple GET
parameters in a URL, they need to be separated with ampersands i.e.
http://domain.com/page?var1=1&var2=2
You need to replace the ?
in the URL before amount
with a &
so it becomes echo '<img src="generateQR.php?address='.$newOrderaddress.'&amount='.$order_amountbtc.'"/>'
Upvotes: 3