nik
nik

Reputation: 69

Redirection in php dynamic

I have problem in redirecting my url.

I have url:-

http://example.com/r/index.php?id=1234

it gives me value of url from database.I store the value of url in $url_link.

On the same page,after db operation.I add the redirect code in body part.

<?php    
header('Location: http://$url_link');    
?>

which doesnt take the value $url_link.

Upvotes: 1

Views: 61

Answers (2)

Enclose in double quotes.. Variables inside single quotes will not get interpreted.

Do like this...

<?php    
header("Location: http://$url_link");    
?>

Upvotes: 2

Vikas Arora
Vikas Arora

Reputation: 1666

It should be something like this.

<?php    
  header('Location: http://'.$url_link);    
?>

Upvotes: 3

Related Questions