it is always in english I want to choose in japanese as well

<?php
if((!isset($_SESSION['lang']))||(!isset($_GET['lang']))){
    $_SESSION['lang'] = "en";
    $currLang ="en";
} else {
    $currLang = $_GET['lang'];
    $_SESSION['lang'] = $currLang;
}
switch($currLang){
    case "en":
    define("CHARSET","ISO-8859-1");
    define("LANGCODE","en");
    echo "english";
    break;

    case "ja":
        define("CHARSET","UTF-8");
        define("LANGCODE","ja");
        echo "japanese";
        break;

    default:
        define("CHARSET","ISO-8859-1");
        define("LANGCODE","en");
        break;
}

header("Content-Type: text/html;charset=".CHARSET);
header("Content-Language: ".LANGCODE);
?>

?lang=en or ?lang=ja

    if((!isset($_SESSION['lang']))||(!isset($_GET['lang']))){
        $_SESSION['lang'] = "en";
        $currLang ="en";
    } else {
        $currLang = $_GET['lang'];
        $_SESSION['lang'] = $currLang;
    }

    Assuming you're having a problem with something I'm going to point out that you fail to handle the case where the SESSION variable is set but the GET variable is not.
    Assuming you want the GET variable to override the SESSION variable, and you want English for a default:

    if(isset($_GET['lang'])) {
    	// In the real world you'd check you got
    	// a valid value from the user here
    	$_SESSION['lang'] = $_GET['lang'];
    } elseif(!isset($_SESSION['lang'])) {
    	$_SESSION['lang'] = 'en';
    }
    $currLang = $_SESSION['lang'];

    One more thing:

        define("CHARSET","ISO-8859-1");

    You might as well use UTF-8 for everything. The whole point of Unicode is to avoid needing different encodings for different languages.

    It occurs to me this might be a useful place to use the null coalesce operator (??), something like:

    $currLang = $_GET['lang'] ?? $_SESSION['lang'] ?? 'en';
    if(!in_array($currLang, ['en', 'ja'])) {
      $currLang = 'en';
      // possibly error_log() something here if you want to track this?
    }
    $_SESSION['lang'] = $currLang; // per Weedpacket's suggestion
    define('LANGCODE', $currLang);
    
    Write a Reply...