0

This is the trouble-making code:

<?php
//some code here
$zone = 'op';
$url = 'thread-list.php?zone=$zone';
header('Location : '.$url);
?>

Everything before and after header is working fine but the page is not getting redirected! What should I do? Using Header is working fine on other pages except here!

abhishah901
  • 539
  • 1
  • 8
  • 16

2 Answers2

1

Use this:

There should be no space between "location" and ":"

$url='http://google.com' ;
 header("location: $url"); 

OR

header("Location: ".$url); 

Also

    $url = 'thread-list.php?zone=$zone';

Here $zone is error It will not print the value of $zone

PHP Worm...
  • 4,109
  • 1
  • 25
  • 48
0

You should use either:

header("Location: " . $url);

or

header("Location: $url");
(double quotes evaluate the content)

What is the difference between single-quoted and double-quoted strings in PHP?

Community
  • 1
  • 1
achasinh
  • 530
  • 8
  • 17