The page is a questionnaire that uses a load & save as you go setup. When you hit the next button, it saves the currently displayed questions, and loads the next set of questions. There is also a previous button and at the end a submit button.
The html page has a container for everything, and then ajax would bring in the questions and buttons.
The unexpected result is a php variable is not echoed with the rest of the string. The php code is in the second code block, and the code proving this result is in the third code block.
Here is the simplified container:
<body onload="loadSlide(<?php echo $_GET["ID"]; ?>, 'Next', hdn_Section_Counter.value)">
<div id="div_Questionnaire" class="Main_Content" >
<p class="Main_Content_Title"> Plannning For Success - Questionnaire </p>
<div class="Sub_Content" id="div_Questions">
<p class="Sub_Content_Title"> Questions </p>
<div id="div_Question_Holder"><!--Holds the questions-->
<input id="hdn_Section_Counter" type="hidden" value="0" Subject="1" Category="1" Section="1"/>
<!--Keeps track of current slide under 2 counting forums - section count (values 1-22), and Subject-Category-Section-->
/*$_POST["ID"] was sent over through ajax in the send() method (using POST)
$_SESSION["uid"] is created on login, there is a session_start() (to resume
the session) at the beginning of the php file.*/
var_dump($Viewing_Student);//displays "false" as a boolean value
echo"<input class='Nav_Button' id='btn_Previous' type='button' value='Previous' onclick=\"saveSlide('/my-site/Tools/Planning_For_Success/save_slide.php', ".$_POST["ID"].", this.value, ".$Viewing_Student.")\"/>";
<input class="Nav_Button" id="btn_Previous" type="button" value="Previous" onclick="saveSlide('/my-site/Tools/Planning_For_Success/save_slide.php', 1, this.value, )">
php > echo 'x' . true . 'x'; x1x php > echo 'x' . false . 'x'; xx
Note how the
false became a zero-length string. That'd produce a JS syntax error in your code.
php > echo 'x' . json_encode(true) . 'x'; xtruex php > echo 'x' . json_encode(false) . 'x'; xfalsex