jmpetre Posted September 1, 2009 Share Posted September 1, 2009 OK, let me preface this by saying that I am not a PHP programmer, but I need to hack this code snippet that was given to me. I have a php invoicing program running on my webserver, and I want to insert this piece of code into the invoices so my customers can pay via PayPal: <?php $amount = number_format($row->total_with_tax - $row->amount_paid, 2, '.', ''); $link = urlencode("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick¤cy_code=USD&business=$companyInfo->primary_contact_email&amount=$amount&item_name=$row->name - Invoice $row->invoice_number"); echo "<p>Pay the balance using PayPal - <a href='$link'>Click Here</a></p>"; ?> The problem is, when I click on the link this generates, it tacks the link on like a relative link. It looks like this: http://www.abc.com:8080/index.php/invoices/view/https://www.paypal.com/cgi-bin/webscr%3Fcmd%3D_xclick%26currency_code%3DUSD%26business%3Dadmin@abc.com%26amount%3D0.00%26item_name%3DJane+Doe+-+Invoice+6 Is there something wrong with the code snippet? Any help is greatly appreciated. Thank you. Jesse Quote Link to comment https://forums.phpfreaks.com/topic/172692-php-absolute-link-shows-up-as-relative-help/ Share on other sites More sharing options...
JonnoTheDev Posted September 1, 2009 Share Posted September 1, 2009 <?php $amount = number_format($row->total_with_tax - $row->amount_paid, 2, '.', ''); $link = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick¤cy_code=USD&business=".urlencode($companyInfo->primary_contact_email)."&amount=".urlencode($amount)."&item_name=".urlencode($row->name." - Invoice ".$row->invoice_number); echo "<p>Pay the balance using PayPal - <a href='".$link."'>Click Here</a></p>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/172692-php-absolute-link-shows-up-as-relative-help/#findComment-910269 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.