paypal - php in header url error -


i have quick question. using normal html link tag redirect paypal checkout page , working fine when had php inside url. when using in php header
url cuts off enter php.

header('location: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=xxxx&lc=uk&item_name=<? echo $product . " " . $server ?>&amount=<? echo $xprice1; ?>%2e00&currency_code=gbp&button_subtype=services&no_note=0&bn=pp%2dbuynowbf%3abtn_buynowcc_lg%2egif%3anonhostedguest'); 

you placing php code inside of location redirect string. code not being evaluated php.

try instead:

<?php $url =  "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=xxxx&lc=uk&item_name=" . $product . " " . $server ."&amount=" . $xprice1 . "%2e00&currency_code=gbp&button_subtype=services&no_note=0&bn=pp%2dbuynowbf%3abtn_buynowcc_lg%2egif%3anonhostedguest"; header('location: ' . $url); 

or, keep in 1 line so:

<?php header('location: ' . "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=xxxx&lc=uk&item_name=" . $product . " " . $server ."&amount=" . $xprice1 . "%2e00&currency_code=gbp&button_subtype=services&no_note=0&bn=pp%2dbuynowbf%3abtn_buynowcc_lg%2egif%3anonhostedguest"); 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -