it is still redirecting

0 MAYANK JINDAL · April 29, 2015
<h1>sdxas</h1>
<?php
$redirect_page = 'http://www.google.co.in';         //redirect location
$redirect = true;
if($redirect){
header('Location:'.$redirect_page);
}
 ?>

Post a Reply

Replies

Oldest  Newest  Rating
0 Peer Ligthart · April 30, 2015
What's the problem here? If you don't want it to redirect you should do:

$redirect = false;
0 Shawn Menning · May 10, 2015
both Peer and CliQ are correct. As it stands you have $redirect set to true immediately followed but a if statement stating that if $redirect is set to true then go ahead and redirect.  No other option.  IF you want this code to run as you intend, I am guessing you need to set up conditions that would allow $redirect to change to false.  This could be done most effectively inside a function.  As it stands though your going to redirect no matter what.
  • 1

PHP

107,269 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators