1

why header function does not work here ? it work successfully on localhost

<?php
    session_start();
    if(isset($_POST['submit'])){
        require_once('models/config.php');  require_once('models/mysql.class.php');
        $username=$_POST['username'];
        $password=$_POST['password'];       
        $obj_Pharmacies=new mysql();     
        $sql_query="SELECT * FROM `sellers_accounts` WHERE`user_name`='$username' AND `password`='$password'";
        $obj_Pharmacies->Execute($sql_query);
        if($obj_Pharmacies->Execute($sql_query)){

            $Pharmacies=$obj_Pharmacies->GetRows();         
            $cookie_seller_name=$Pharmacies[0]['name'];         
            $cookie_seller_user_name=$Pharmacies[0]['user_name'];
            $Pharmacies_number=count($Pharmacies);
            if($Pharmacies_number>=1){
                //$_SESSION['sellerName']=$cookie_seller_name;
                setcookie('sellerName', $cookie_seller_name, time() + (86400 * 30), "/");
                //$_SESSION['sellerUsername']=$cookie_seller_user_name;
                //$_SESSION['sellerName'];
                header("location:plans.php");
          }     
        }


    } 
?>
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98

1 Answers1

1
$base_url =  "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; 
   $redirect_url = $base_url."plans.php";
   header("location:$redirect_url");
Arun
  • 1,609
  • 1
  • 15
  • 18