if (<?php echo $q; ?> == <?php echo QuestionCtrl::size(); ?> ) ssubmit = ' view overall results'; $('#submit').click(function () { if ($('.bt-text').html() == ssubmit) { if (<?php echo $q + 1; ?> > <?php echo QuestionCtrl::size(); ?> ) window.location.href = 'index.php?p=0'; // later move to overall page else window.location.href = 'index.php?p=1&q=<?php echo $q + 1; ?> '; } else { if ($('#selected').val() == '') { $('#submit').addClass('btn-warning').removeClass('btn-primary').removeClass('btn-danger').removeClass('btn-success'); $('.bt-icon').addClass('glyphicon-warning-sign').removeClass('glyphicon-send'); $('.bt-text').html(' select something!'); } else {