I get the error " Undefined array key "q2" in.."when ever i try to access data from $_SESSION[""] after i change the language with google translate in my php website
my code
// using google translate
<div id="google_translate_elemen" class='btn'></div>
  <script type="text/javascript">
        function googleTranslateElementInit() {
            new google.translate.TranslateElement({
                pageLanguage: 'en'
            }, 'google_translate_elemen');
        }
    </script>
    <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
// getting my data
    $req = $con->prepare('SELECT q_id,q_text FROM question where cat = ? ');
    $req->execute(array($ca));
  while ($qdata = $req->fetch()) {
        $_SESSION["qid"] = $qdata[0];
        $req2 = $con->prepare('SELECT w.wa_text,w.wa_id FROM wrong_ans w where w.cat = ? and w.q_id=?');
        $req2->execute(array($ca, $qdata[0]));
        while ($adata = $req2->fetch()) {
            echo  " <input type='radio' id='$adata[0]' name='$qdata[0]' value='$adata[1]''>
                        <label for='$adata[0]'>$adata[0]</label><br>";}
//manipulating the data i get
if(isset($_POST['submit_btn'])){
$id = "nodata";
                    if (isset($_POST[$_SESSION["qid"]])) {
                        $id = $_POST[$_SESSION["qid"]];
                        echo $id;
                        echo $_SESSION["qid"];
                    }
 array_push($_SESSION["ans"], $_POST[$_SESSION["qid"]]); //the executing stops here}
        }
the code works perfectly fine whene i don't change the language. and i don't think that the problem is the $_SESSION since echo $_SESSION["qid"] returns the correct value and echo $id returns nodata
can anyone help me fix that?
