Emerson F
Emerson F

Reputation: 845

PHP redirect/load another page

I know how to redirect/load with this code'

header('Location: http://www.someURL.com');

But what about using with strings?

$edit_invoice = $invoice->invoice->links->edit;
header( 'Location: '.$edit_invoice.' ) ;

I'm using Freshbooks API library in case you're wondering..

Upvotes: 0

Views: 126

Answers (2)

Amos N.
Amos N.

Reputation: 627

You have an extra apostrophe. header( 'Location: '.$edit_invoice ) ;

Upvotes: 1

EM-Creations
EM-Creations

Reputation: 4301

The way you have the string version set up right now won't work, because you're starting a new string at the end of calling the header() function.

header('Location: ' . $edit_invoice);

Should work, as long as $edit_invoice is a valid link.

Upvotes: 0

Related Questions