I have this funcition for a button Preview and this code works in all versions IE less in IE7.The button back with IE7 don't works . Why? How can i solve this?
<?php
//////// --- BUTTON BACK : CHARGE THE QUERY OF BEFORE PAGE WHEN WE PRESS BACK ---/////////////
if ( isset($_POST['back'])){
$_SESSION['onpage']=$_SESSION['onpage']-1;
$query_questionset= "select Q.Constructor AS Constructor,
QS.QuestionIDFKPK AS QuestionIDFKPK,
Q.QuestionValue AS QuestionValue,
QS.SortOrder AS SortOrder,
QS.onpage AS onpage
from tbluserset AS US
inner join tblquestionset AS QS ON
US.QuestionSetIDFKPK = QS.QuestionSetIDPK
inner join tblquestion AS Q ON
QS.QuestionIDFKPK = Q.QuestionIDPK
where (US.UserIDFKPK = ".$UserId.")
and (US.UserSetIDPK= '".$_SESSION['UserSetIDPK']."')
and (QS.onpage = '".$_SESSION['onpage']."')
order by QS.SortOrder";
if($_SESSION['onpage']==0){
$_SESSION['controluserupdate']=1;
}//<-END CASE ONPAGE=0
}//<- END POST [BACK]
?>
<script>
function postBack() {
var myForm = document.getElementById("formID");
var backInput = document.createElement("input");
backInput.type = "hidden";
backInput.name = "back";
backInput.value = "1";
myForm.appendChild(backInput);
};
</script>
< html>
..
....
< form id= "formID" name="formID" class="formular" method="post" action= "<?= $url = "QUESTIONAREFINISHING.php"; ?>" accept-charset="utf-8">
<div id="footer"> <!-- DIV FOOTER CONTAINER BUTTONS OUTSIDE BOX QUESTIONAIRE-->
<?php if($_SESSION['onpage'] >=1 && $_SESSION['onpage'] <= $_SESSION['MaxOnPage']-1){ ?>
<div><button class="botonesform" type="hidden" onclick="postBack()" name="back" value="" > ← Back </button ></div>
<input class="botonesform" type="submit" name="submit" onclick="probandosubmit()" value="Forward →" />
<?php } ?>
</div>
</form>
..
..
</html>
Sorry, didn't see the full code there.
The JavaScript code you posted should work in IE7 so it's probably other code
Could you change:
<input class="botonesform" type="submit" name="submit" onclick="probandosu...
to
<input class="botonesform" type="button" name="submit" onclick="probandosu...
(change the type from submit to button). Then see if there are any script errors in IE7 when you click it. If there aren't any then try to submit the form in probandosubmit() and see if that solved it. I can't see the back button submitting anything, it just tries to add a hidden text input and that should work in IE7