session - PHP header working on localhost but not on live server

827

this is my php page.. if anyone directly visits this page it will read session if the value is not set then value and redirect to page.html. else it will print some message. this is working on local host but not on live server.

<?php 
session_start();
$name = $_SESSION['team']; //a value stored in session which i used on this page  

if (($_SESSION["abc"] !== 'good')) {
    header('Location: http://www.abc.com/page.html');
}
else{
echo $name. 'you have completed register process part one you may continue!';
}
?>
842

Answer

Solution:

Use This


<?php 

session_start();
$name = $_SESSION['team']; //a value stored in session which i used on this page  

if (($_SESSION["abc"] !== 'good')) {
?>
  <script>
    window.location = "http://www.abcd.com/page.html";
  </script>
<?php
}
else{
echo $name. 'you have completed register process part one you may continue!';
}
?>

People are also looking for solutions to the problem: php - Different email heading based on shipping methods in Woocommerce

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.