Reputation: 568
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!
Upvotes: 0
Views: 98
Reputation: 570
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?
Upvotes: 0
Reputation: 4224
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
Upvotes: 1