window.location.href doesn't submit form [duplicate]
up vote
-1
down vote
favorite
This question already has an answer here:
JavaScript post request like a form submit
28 answers
How to submit a form using javascript?
10 answers
I used the Javascript below.
If the time is finished it must redirect to the next page "result.php" by submitting a form. But unfortunately the page displayed is empty.
below my form which must send to the next page "result.php".
I want to have how to send this form and redirect to the next page.
how to send the form with this Javascript to make my page work?
var hoursleft = 3;
var minutesleft = 0;
var secondsleft = 0;
var end1;
var progressBar = document.getElementById('progressBar');
if (localStorage.getItem("end1")) {
end1 = new Date(localStorage.getItem("end1"));
} else {
end1 = new Date();
end1.setMinutes(end1.getMinutes() + minutesleft);
end1.setSeconds(end1.getSeconds() + secondsleft);
end1.setHours(end1.getHours() + hoursleft);
}
progressBar.max = end1 - new Date();
var counter = function() {
var now = new Date();
var diff = end1 - now;
diff = new Date(diff);
var sec = parseInt((diff / 1000) % 60)
var mins = parseInt((diff / (1000 * 60)) % 60)
var hours = parseInt((diff / (1000 * 60 * 60)) % 24);
if (hours < 10) {
hours = "0" + hours;
}
if (mins < 10) {
mins = "0" + mins;
}
if (sec < 10) {
sec = "0" + sec;
}
if (now >= end1) {
clearTimeout(interval);
localStorage.setItem("end", null);
localStorage.removeItem("end1");
localStorage.clear();
if (confirm("TIME UP!"))
window.location.href = "result.php";
//alert("Time finished!");
} else {
progressBar.value = progressBar.max - (end1 - now);
localStorage.setItem("end1", end1);
document.getElementById('hours').innerHTML = "<b>" + hours + "</b> " + ":";
document.getElementById('mins').innerHTML = "<b>" + mins + "</b> " + ":";
document.getElementById('sec').innerHTML = "<b>" + sec + "</b>";
}
}
var interval = setInterval(counter, 1000);
<form class="form-horizontal" role="form" id='question' name="question" method="post" action="result.php">
<?php
$number_question=1;
$limit=10;
$row = mysqli_query( $conn, "select id,question_name,image from testquestion where email = '".$email."' ");
$total = mysqli_num_rows( $row );
$remainder = $total/$number_question;
$i = 0;
$j = 1; $k = 1;
?>
<?php while ( $result = mysqli_fetch_assoc($row) ) {
if ( $i != 0)
echo "<div id='question_splitter_$j'>";
if ( $i == 0)
echo "<div class='cont' id='question_splitter_$j'>";?>
<div id='question<?php echo $k;?>' >
<p class='questions' id="qname<?php echo $j;?>"> <?php echo $k?>.<?php echo $result['question_name'];?>
<input type="checkbox" id="review" name="review" />
<label style="color:#0080ff">Review</label></p>
</br>
<?php echo '<img src="data:image/png;base64,'.($result['image']).'" />'; ?></br><br/><br/>
<input type="text" id="answer<?php echo $result['id'];?>" name="<?php echo $result['id'];?>" placeholder="Enter your answer" />
<br/>
<br/>
</div>
<?php
$i++;
if ( ( $remainder < 1 ) || ( $i == $number_question && $remainder == 1 ) ) {
echo "<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
} elseif ( $total > $number_question ) {
if ( $j == 1 && $i == $number_question ) {
echo "<button id='".$j."' class='next btn btn-primary' type='button'>Next</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $k == $total ) {
echo " <button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<a href='review.php'><button id='review.php' class='previous btn btn-primary' type='button'>Review</button></a>
<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $j > 1 && $i == $number_question ) {
echo "<button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<button id='".$j."' class='next btn btn-primary' type='button' >Next</button>";
echo "</div>";
$i = 0;
$j++;
}
}
$k++;
}
?>
<br/>
<br/>
<br/>
</form>
javascript php html
marked as duplicate by Tigger, Davіd, Quentin
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
-1
down vote
favorite
This question already has an answer here:
JavaScript post request like a form submit
28 answers
How to submit a form using javascript?
10 answers
I used the Javascript below.
If the time is finished it must redirect to the next page "result.php" by submitting a form. But unfortunately the page displayed is empty.
below my form which must send to the next page "result.php".
I want to have how to send this form and redirect to the next page.
how to send the form with this Javascript to make my page work?
var hoursleft = 3;
var minutesleft = 0;
var secondsleft = 0;
var end1;
var progressBar = document.getElementById('progressBar');
if (localStorage.getItem("end1")) {
end1 = new Date(localStorage.getItem("end1"));
} else {
end1 = new Date();
end1.setMinutes(end1.getMinutes() + minutesleft);
end1.setSeconds(end1.getSeconds() + secondsleft);
end1.setHours(end1.getHours() + hoursleft);
}
progressBar.max = end1 - new Date();
var counter = function() {
var now = new Date();
var diff = end1 - now;
diff = new Date(diff);
var sec = parseInt((diff / 1000) % 60)
var mins = parseInt((diff / (1000 * 60)) % 60)
var hours = parseInt((diff / (1000 * 60 * 60)) % 24);
if (hours < 10) {
hours = "0" + hours;
}
if (mins < 10) {
mins = "0" + mins;
}
if (sec < 10) {
sec = "0" + sec;
}
if (now >= end1) {
clearTimeout(interval);
localStorage.setItem("end", null);
localStorage.removeItem("end1");
localStorage.clear();
if (confirm("TIME UP!"))
window.location.href = "result.php";
//alert("Time finished!");
} else {
progressBar.value = progressBar.max - (end1 - now);
localStorage.setItem("end1", end1);
document.getElementById('hours').innerHTML = "<b>" + hours + "</b> " + ":";
document.getElementById('mins').innerHTML = "<b>" + mins + "</b> " + ":";
document.getElementById('sec').innerHTML = "<b>" + sec + "</b>";
}
}
var interval = setInterval(counter, 1000);
<form class="form-horizontal" role="form" id='question' name="question" method="post" action="result.php">
<?php
$number_question=1;
$limit=10;
$row = mysqli_query( $conn, "select id,question_name,image from testquestion where email = '".$email."' ");
$total = mysqli_num_rows( $row );
$remainder = $total/$number_question;
$i = 0;
$j = 1; $k = 1;
?>
<?php while ( $result = mysqli_fetch_assoc($row) ) {
if ( $i != 0)
echo "<div id='question_splitter_$j'>";
if ( $i == 0)
echo "<div class='cont' id='question_splitter_$j'>";?>
<div id='question<?php echo $k;?>' >
<p class='questions' id="qname<?php echo $j;?>"> <?php echo $k?>.<?php echo $result['question_name'];?>
<input type="checkbox" id="review" name="review" />
<label style="color:#0080ff">Review</label></p>
</br>
<?php echo '<img src="data:image/png;base64,'.($result['image']).'" />'; ?></br><br/><br/>
<input type="text" id="answer<?php echo $result['id'];?>" name="<?php echo $result['id'];?>" placeholder="Enter your answer" />
<br/>
<br/>
</div>
<?php
$i++;
if ( ( $remainder < 1 ) || ( $i == $number_question && $remainder == 1 ) ) {
echo "<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
} elseif ( $total > $number_question ) {
if ( $j == 1 && $i == $number_question ) {
echo "<button id='".$j."' class='next btn btn-primary' type='button'>Next</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $k == $total ) {
echo " <button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<a href='review.php'><button id='review.php' class='previous btn btn-primary' type='button'>Review</button></a>
<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $j > 1 && $i == $number_question ) {
echo "<button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<button id='".$j."' class='next btn btn-primary' type='button' >Next</button>";
echo "</div>";
$i = 0;
$j++;
}
}
$k++;
}
?>
<br/>
<br/>
<br/>
</form>
javascript php html
marked as duplicate by Tigger, Davіd, Quentin
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Use$("#question").submit();
in place ofwindow.location.href = "result.php";
– Twinkle
2 hours ago
It works Thank you very much.
– sonia
2 hours ago
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
This question already has an answer here:
JavaScript post request like a form submit
28 answers
How to submit a form using javascript?
10 answers
I used the Javascript below.
If the time is finished it must redirect to the next page "result.php" by submitting a form. But unfortunately the page displayed is empty.
below my form which must send to the next page "result.php".
I want to have how to send this form and redirect to the next page.
how to send the form with this Javascript to make my page work?
var hoursleft = 3;
var minutesleft = 0;
var secondsleft = 0;
var end1;
var progressBar = document.getElementById('progressBar');
if (localStorage.getItem("end1")) {
end1 = new Date(localStorage.getItem("end1"));
} else {
end1 = new Date();
end1.setMinutes(end1.getMinutes() + minutesleft);
end1.setSeconds(end1.getSeconds() + secondsleft);
end1.setHours(end1.getHours() + hoursleft);
}
progressBar.max = end1 - new Date();
var counter = function() {
var now = new Date();
var diff = end1 - now;
diff = new Date(diff);
var sec = parseInt((diff / 1000) % 60)
var mins = parseInt((diff / (1000 * 60)) % 60)
var hours = parseInt((diff / (1000 * 60 * 60)) % 24);
if (hours < 10) {
hours = "0" + hours;
}
if (mins < 10) {
mins = "0" + mins;
}
if (sec < 10) {
sec = "0" + sec;
}
if (now >= end1) {
clearTimeout(interval);
localStorage.setItem("end", null);
localStorage.removeItem("end1");
localStorage.clear();
if (confirm("TIME UP!"))
window.location.href = "result.php";
//alert("Time finished!");
} else {
progressBar.value = progressBar.max - (end1 - now);
localStorage.setItem("end1", end1);
document.getElementById('hours').innerHTML = "<b>" + hours + "</b> " + ":";
document.getElementById('mins').innerHTML = "<b>" + mins + "</b> " + ":";
document.getElementById('sec').innerHTML = "<b>" + sec + "</b>";
}
}
var interval = setInterval(counter, 1000);
<form class="form-horizontal" role="form" id='question' name="question" method="post" action="result.php">
<?php
$number_question=1;
$limit=10;
$row = mysqli_query( $conn, "select id,question_name,image from testquestion where email = '".$email."' ");
$total = mysqli_num_rows( $row );
$remainder = $total/$number_question;
$i = 0;
$j = 1; $k = 1;
?>
<?php while ( $result = mysqli_fetch_assoc($row) ) {
if ( $i != 0)
echo "<div id='question_splitter_$j'>";
if ( $i == 0)
echo "<div class='cont' id='question_splitter_$j'>";?>
<div id='question<?php echo $k;?>' >
<p class='questions' id="qname<?php echo $j;?>"> <?php echo $k?>.<?php echo $result['question_name'];?>
<input type="checkbox" id="review" name="review" />
<label style="color:#0080ff">Review</label></p>
</br>
<?php echo '<img src="data:image/png;base64,'.($result['image']).'" />'; ?></br><br/><br/>
<input type="text" id="answer<?php echo $result['id'];?>" name="<?php echo $result['id'];?>" placeholder="Enter your answer" />
<br/>
<br/>
</div>
<?php
$i++;
if ( ( $remainder < 1 ) || ( $i == $number_question && $remainder == 1 ) ) {
echo "<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
} elseif ( $total > $number_question ) {
if ( $j == 1 && $i == $number_question ) {
echo "<button id='".$j."' class='next btn btn-primary' type='button'>Next</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $k == $total ) {
echo " <button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<a href='review.php'><button id='review.php' class='previous btn btn-primary' type='button'>Review</button></a>
<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $j > 1 && $i == $number_question ) {
echo "<button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<button id='".$j."' class='next btn btn-primary' type='button' >Next</button>";
echo "</div>";
$i = 0;
$j++;
}
}
$k++;
}
?>
<br/>
<br/>
<br/>
</form>
javascript php html
This question already has an answer here:
JavaScript post request like a form submit
28 answers
How to submit a form using javascript?
10 answers
I used the Javascript below.
If the time is finished it must redirect to the next page "result.php" by submitting a form. But unfortunately the page displayed is empty.
below my form which must send to the next page "result.php".
I want to have how to send this form and redirect to the next page.
how to send the form with this Javascript to make my page work?
var hoursleft = 3;
var minutesleft = 0;
var secondsleft = 0;
var end1;
var progressBar = document.getElementById('progressBar');
if (localStorage.getItem("end1")) {
end1 = new Date(localStorage.getItem("end1"));
} else {
end1 = new Date();
end1.setMinutes(end1.getMinutes() + minutesleft);
end1.setSeconds(end1.getSeconds() + secondsleft);
end1.setHours(end1.getHours() + hoursleft);
}
progressBar.max = end1 - new Date();
var counter = function() {
var now = new Date();
var diff = end1 - now;
diff = new Date(diff);
var sec = parseInt((diff / 1000) % 60)
var mins = parseInt((diff / (1000 * 60)) % 60)
var hours = parseInt((diff / (1000 * 60 * 60)) % 24);
if (hours < 10) {
hours = "0" + hours;
}
if (mins < 10) {
mins = "0" + mins;
}
if (sec < 10) {
sec = "0" + sec;
}
if (now >= end1) {
clearTimeout(interval);
localStorage.setItem("end", null);
localStorage.removeItem("end1");
localStorage.clear();
if (confirm("TIME UP!"))
window.location.href = "result.php";
//alert("Time finished!");
} else {
progressBar.value = progressBar.max - (end1 - now);
localStorage.setItem("end1", end1);
document.getElementById('hours').innerHTML = "<b>" + hours + "</b> " + ":";
document.getElementById('mins').innerHTML = "<b>" + mins + "</b> " + ":";
document.getElementById('sec').innerHTML = "<b>" + sec + "</b>";
}
}
var interval = setInterval(counter, 1000);
<form class="form-horizontal" role="form" id='question' name="question" method="post" action="result.php">
<?php
$number_question=1;
$limit=10;
$row = mysqli_query( $conn, "select id,question_name,image from testquestion where email = '".$email."' ");
$total = mysqli_num_rows( $row );
$remainder = $total/$number_question;
$i = 0;
$j = 1; $k = 1;
?>
<?php while ( $result = mysqli_fetch_assoc($row) ) {
if ( $i != 0)
echo "<div id='question_splitter_$j'>";
if ( $i == 0)
echo "<div class='cont' id='question_splitter_$j'>";?>
<div id='question<?php echo $k;?>' >
<p class='questions' id="qname<?php echo $j;?>"> <?php echo $k?>.<?php echo $result['question_name'];?>
<input type="checkbox" id="review" name="review" />
<label style="color:#0080ff">Review</label></p>
</br>
<?php echo '<img src="data:image/png;base64,'.($result['image']).'" />'; ?></br><br/><br/>
<input type="text" id="answer<?php echo $result['id'];?>" name="<?php echo $result['id'];?>" placeholder="Enter your answer" />
<br/>
<br/>
</div>
<?php
$i++;
if ( ( $remainder < 1 ) || ( $i == $number_question && $remainder == 1 ) ) {
echo "<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
} elseif ( $total > $number_question ) {
if ( $j == 1 && $i == $number_question ) {
echo "<button id='".$j."' class='next btn btn-primary' type='button'>Next</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $k == $total ) {
echo " <button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<a href='review.php'><button id='review.php' class='previous btn btn-primary' type='button'>Review</button></a>
<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $j > 1 && $i == $number_question ) {
echo "<button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<button id='".$j."' class='next btn btn-primary' type='button' >Next</button>";
echo "</div>";
$i = 0;
$j++;
}
}
$k++;
}
?>
<br/>
<br/>
<br/>
</form>
This question already has an answer here:
JavaScript post request like a form submit
28 answers
How to submit a form using javascript?
10 answers
var hoursleft = 3;
var minutesleft = 0;
var secondsleft = 0;
var end1;
var progressBar = document.getElementById('progressBar');
if (localStorage.getItem("end1")) {
end1 = new Date(localStorage.getItem("end1"));
} else {
end1 = new Date();
end1.setMinutes(end1.getMinutes() + minutesleft);
end1.setSeconds(end1.getSeconds() + secondsleft);
end1.setHours(end1.getHours() + hoursleft);
}
progressBar.max = end1 - new Date();
var counter = function() {
var now = new Date();
var diff = end1 - now;
diff = new Date(diff);
var sec = parseInt((diff / 1000) % 60)
var mins = parseInt((diff / (1000 * 60)) % 60)
var hours = parseInt((diff / (1000 * 60 * 60)) % 24);
if (hours < 10) {
hours = "0" + hours;
}
if (mins < 10) {
mins = "0" + mins;
}
if (sec < 10) {
sec = "0" + sec;
}
if (now >= end1) {
clearTimeout(interval);
localStorage.setItem("end", null);
localStorage.removeItem("end1");
localStorage.clear();
if (confirm("TIME UP!"))
window.location.href = "result.php";
//alert("Time finished!");
} else {
progressBar.value = progressBar.max - (end1 - now);
localStorage.setItem("end1", end1);
document.getElementById('hours').innerHTML = "<b>" + hours + "</b> " + ":";
document.getElementById('mins').innerHTML = "<b>" + mins + "</b> " + ":";
document.getElementById('sec').innerHTML = "<b>" + sec + "</b>";
}
}
var interval = setInterval(counter, 1000);
<form class="form-horizontal" role="form" id='question' name="question" method="post" action="result.php">
<?php
$number_question=1;
$limit=10;
$row = mysqli_query( $conn, "select id,question_name,image from testquestion where email = '".$email."' ");
$total = mysqli_num_rows( $row );
$remainder = $total/$number_question;
$i = 0;
$j = 1; $k = 1;
?>
<?php while ( $result = mysqli_fetch_assoc($row) ) {
if ( $i != 0)
echo "<div id='question_splitter_$j'>";
if ( $i == 0)
echo "<div class='cont' id='question_splitter_$j'>";?>
<div id='question<?php echo $k;?>' >
<p class='questions' id="qname<?php echo $j;?>"> <?php echo $k?>.<?php echo $result['question_name'];?>
<input type="checkbox" id="review" name="review" />
<label style="color:#0080ff">Review</label></p>
</br>
<?php echo '<img src="data:image/png;base64,'.($result['image']).'" />'; ?></br><br/><br/>
<input type="text" id="answer<?php echo $result['id'];?>" name="<?php echo $result['id'];?>" placeholder="Enter your answer" />
<br/>
<br/>
</div>
<?php
$i++;
if ( ( $remainder < 1 ) || ( $i == $number_question && $remainder == 1 ) ) {
echo "<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
} elseif ( $total > $number_question ) {
if ( $j == 1 && $i == $number_question ) {
echo "<button id='".$j."' class='next btn btn-primary' type='button'>Next</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $k == $total ) {
echo " <button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<a href='review.php'><button id='review.php' class='previous btn btn-primary' type='button'>Review</button></a>
<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $j > 1 && $i == $number_question ) {
echo "<button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<button id='".$j."' class='next btn btn-primary' type='button' >Next</button>";
echo "</div>";
$i = 0;
$j++;
}
}
$k++;
}
?>
<br/>
<br/>
<br/>
</form>
var hoursleft = 3;
var minutesleft = 0;
var secondsleft = 0;
var end1;
var progressBar = document.getElementById('progressBar');
if (localStorage.getItem("end1")) {
end1 = new Date(localStorage.getItem("end1"));
} else {
end1 = new Date();
end1.setMinutes(end1.getMinutes() + minutesleft);
end1.setSeconds(end1.getSeconds() + secondsleft);
end1.setHours(end1.getHours() + hoursleft);
}
progressBar.max = end1 - new Date();
var counter = function() {
var now = new Date();
var diff = end1 - now;
diff = new Date(diff);
var sec = parseInt((diff / 1000) % 60)
var mins = parseInt((diff / (1000 * 60)) % 60)
var hours = parseInt((diff / (1000 * 60 * 60)) % 24);
if (hours < 10) {
hours = "0" + hours;
}
if (mins < 10) {
mins = "0" + mins;
}
if (sec < 10) {
sec = "0" + sec;
}
if (now >= end1) {
clearTimeout(interval);
localStorage.setItem("end", null);
localStorage.removeItem("end1");
localStorage.clear();
if (confirm("TIME UP!"))
window.location.href = "result.php";
//alert("Time finished!");
} else {
progressBar.value = progressBar.max - (end1 - now);
localStorage.setItem("end1", end1);
document.getElementById('hours').innerHTML = "<b>" + hours + "</b> " + ":";
document.getElementById('mins').innerHTML = "<b>" + mins + "</b> " + ":";
document.getElementById('sec').innerHTML = "<b>" + sec + "</b>";
}
}
var interval = setInterval(counter, 1000);
<form class="form-horizontal" role="form" id='question' name="question" method="post" action="result.php">
<?php
$number_question=1;
$limit=10;
$row = mysqli_query( $conn, "select id,question_name,image from testquestion where email = '".$email."' ");
$total = mysqli_num_rows( $row );
$remainder = $total/$number_question;
$i = 0;
$j = 1; $k = 1;
?>
<?php while ( $result = mysqli_fetch_assoc($row) ) {
if ( $i != 0)
echo "<div id='question_splitter_$j'>";
if ( $i == 0)
echo "<div class='cont' id='question_splitter_$j'>";?>
<div id='question<?php echo $k;?>' >
<p class='questions' id="qname<?php echo $j;?>"> <?php echo $k?>.<?php echo $result['question_name'];?>
<input type="checkbox" id="review" name="review" />
<label style="color:#0080ff">Review</label></p>
</br>
<?php echo '<img src="data:image/png;base64,'.($result['image']).'" />'; ?></br><br/><br/>
<input type="text" id="answer<?php echo $result['id'];?>" name="<?php echo $result['id'];?>" placeholder="Enter your answer" />
<br/>
<br/>
</div>
<?php
$i++;
if ( ( $remainder < 1 ) || ( $i == $number_question && $remainder == 1 ) ) {
echo "<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
} elseif ( $total > $number_question ) {
if ( $j == 1 && $i == $number_question ) {
echo "<button id='".$j."' class='next btn btn-primary' type='button'>Next</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $k == $total ) {
echo " <button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<a href='review.php'><button id='review.php' class='previous btn btn-primary' type='button'>Review</button></a>
<button id='".$j."' class='next btn btn-primary' type='submit'>Finish</button>";
echo "</div>";
$i = 0;
$j++;
} elseif ( $j > 1 && $i == $number_question ) {
echo "<button id='".$j."' class='previous btn btn-primary' type='button'>Previous</button>
<button id='".$j."' class='next btn btn-primary' type='button' >Next</button>";
echo "</div>";
$i = 0;
$j++;
}
}
$k++;
}
?>
<br/>
<br/>
<br/>
</form>
javascript php html
javascript php html
edited 2 hours ago
asked 2 hours ago
sonia
73
73
marked as duplicate by Tigger, Davіd, Quentin
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Tigger, Davіd, Quentin
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Use$("#question").submit();
in place ofwindow.location.href = "result.php";
– Twinkle
2 hours ago
It works Thank you very much.
– sonia
2 hours ago
add a comment |
1
Use$("#question").submit();
in place ofwindow.location.href = "result.php";
– Twinkle
2 hours ago
It works Thank you very much.
– sonia
2 hours ago
1
1
Use
$("#question").submit();
in place of window.location.href = "result.php";
– Twinkle
2 hours ago
Use
$("#question").submit();
in place of window.location.href = "result.php";
– Twinkle
2 hours ago
It works Thank you very much.
– sonia
2 hours ago
It works Thank you very much.
– sonia
2 hours ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You have to use document.getElementById('question').submit();
with window.location.href = "result.php";
the POST data isnt posted
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You have to use document.getElementById('question').submit();
with window.location.href = "result.php";
the POST data isnt posted
add a comment |
up vote
0
down vote
You have to use document.getElementById('question').submit();
with window.location.href = "result.php";
the POST data isnt posted
add a comment |
up vote
0
down vote
up vote
0
down vote
You have to use document.getElementById('question').submit();
with window.location.href = "result.php";
the POST data isnt posted
You have to use document.getElementById('question').submit();
with window.location.href = "result.php";
the POST data isnt posted
answered 2 hours ago
Rick Grendel
42118
42118
add a comment |
add a comment |
1
Use
$("#question").submit();
in place ofwindow.location.href = "result.php";
– Twinkle
2 hours ago
It works Thank you very much.
– sonia
2 hours ago