How to hide the html form and then show the output after clickin on submit button?
up vote
1
down vote
favorite
Here is my form
<form action="" method="POST" id="f1">
<h3><I>GENERATE HERE !</I></h3>
<div class="row">
<div class="col-25">
<label for="qnum">Select no.of questions:</label>
</div>
<div class = "col-75"><input type="number" id="qnum" name="que" value="1" min="1" max="100"></div>
<br /><br />
</div>
<br />
<div class="row">
<div class="col-25">
<label for="int">Select no. of Integers:</label></div>
<div class="col-75">
<select name="select" id="int">
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-25">
<label for="dig">Select no. of digits:</label></div>
<div class="col-75">
<select name="digits" id="dig">
<option value="1"> 1 digit</option>
</select>
</div>
<br /><br /><br /><br />
</div>
<div class="row">
<div class="col-25"><label>Select operations:</label><br /></div>
<div class="col-75">
<input type="checkbox" id="mix" value="all" class="toggle-button"><label>All</label>
<input type="checkbox" id="add" name="operation" value="Addition" checked><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="Subtraction"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="Multiplication"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="Division"><label>Division</label>
</div>
<br /><br />
<br /><br />
</div><br />
<input type="submit" name="submit" value="Generate" id = "gen">
<button class="button btn1">Play</button><br>
<br />
</form>
</div>
<script>
$( '.col-75 .toggle-button' ).click( function () {
$( '.col-75 input[type="checkbox"]' ).prop('checked', this.checked)
})
</script>
Below is my php code which is working perfectly. My purpose is to hide the form on clicking play button.and then show the output of my code, how can I do that?
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit'])){
if($_POST['digits'] == 1){
$q = $_POST['que'];
$rOperators = array('+','-','*','/')
$previousInt = null; //Track the previous operand
$s = $_POST['select'];
for ($x = 1; $x<=$q; $x++){ //for loop for no. of questions
$randomOperands = array();
$randomOperators = array();
// loop over $i n times
for ($i = 1; $i <=$s; $i++){ //for loop for no. of integers user entered
$nextInt = rand(1, 9); // assign random operand to array slot
$randomOperands = $nextInt;
if($i < $s){
if($previousInt === 0) //No operator after last opearnd
{
//avoid division-by-zero
$randomOperators = $rOperators[rand(0, 2)];
}else{
$randomOperators = $rOperators[rand(0, $N-1)];
}
}
$previousInt = $nextInt;
}
// print array values
$exp = '';
$output_string = " ";
//Generating the expression
foreach($randomOperands as $key=>$value1){
$exp .= $value1 . "" ;
$output_string .= $value1. "<br>";
if(isset($randomOperators[$key])){
$exp .= $randomOperators[$key] ."";
$output_string .= $randomOperators[$key]."<br>";
}
}
//print expression
$res = eval("return ($exp);");//evaluate the expression
echo ("This is Q(".$x."): <br>"), $output_string. "<br>________<br>".$res."<br>";
}
}
}
?>
The output is generating perfectly fine. I ma just getting trouble in the functionality of hide the form on clicking play button and then show the output , so how can I do that?
php jquery html
add a comment |
up vote
1
down vote
favorite
Here is my form
<form action="" method="POST" id="f1">
<h3><I>GENERATE HERE !</I></h3>
<div class="row">
<div class="col-25">
<label for="qnum">Select no.of questions:</label>
</div>
<div class = "col-75"><input type="number" id="qnum" name="que" value="1" min="1" max="100"></div>
<br /><br />
</div>
<br />
<div class="row">
<div class="col-25">
<label for="int">Select no. of Integers:</label></div>
<div class="col-75">
<select name="select" id="int">
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-25">
<label for="dig">Select no. of digits:</label></div>
<div class="col-75">
<select name="digits" id="dig">
<option value="1"> 1 digit</option>
</select>
</div>
<br /><br /><br /><br />
</div>
<div class="row">
<div class="col-25"><label>Select operations:</label><br /></div>
<div class="col-75">
<input type="checkbox" id="mix" value="all" class="toggle-button"><label>All</label>
<input type="checkbox" id="add" name="operation" value="Addition" checked><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="Subtraction"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="Multiplication"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="Division"><label>Division</label>
</div>
<br /><br />
<br /><br />
</div><br />
<input type="submit" name="submit" value="Generate" id = "gen">
<button class="button btn1">Play</button><br>
<br />
</form>
</div>
<script>
$( '.col-75 .toggle-button' ).click( function () {
$( '.col-75 input[type="checkbox"]' ).prop('checked', this.checked)
})
</script>
Below is my php code which is working perfectly. My purpose is to hide the form on clicking play button.and then show the output of my code, how can I do that?
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit'])){
if($_POST['digits'] == 1){
$q = $_POST['que'];
$rOperators = array('+','-','*','/')
$previousInt = null; //Track the previous operand
$s = $_POST['select'];
for ($x = 1; $x<=$q; $x++){ //for loop for no. of questions
$randomOperands = array();
$randomOperators = array();
// loop over $i n times
for ($i = 1; $i <=$s; $i++){ //for loop for no. of integers user entered
$nextInt = rand(1, 9); // assign random operand to array slot
$randomOperands = $nextInt;
if($i < $s){
if($previousInt === 0) //No operator after last opearnd
{
//avoid division-by-zero
$randomOperators = $rOperators[rand(0, 2)];
}else{
$randomOperators = $rOperators[rand(0, $N-1)];
}
}
$previousInt = $nextInt;
}
// print array values
$exp = '';
$output_string = " ";
//Generating the expression
foreach($randomOperands as $key=>$value1){
$exp .= $value1 . "" ;
$output_string .= $value1. "<br>";
if(isset($randomOperators[$key])){
$exp .= $randomOperators[$key] ."";
$output_string .= $randomOperators[$key]."<br>";
}
}
//print expression
$res = eval("return ($exp);");//evaluate the expression
echo ("This is Q(".$x."): <br>"), $output_string. "<br>________<br>".$res."<br>";
}
}
}
?>
The output is generating perfectly fine. I ma just getting trouble in the functionality of hide the form on clicking play button and then show the output , so how can I do that?
php jquery html
wrap the whole html form in a bigif(!isset($_POST['submit']))
. That way it will either show the form or the results.
– Dirk Scholten
Nov 20 at 11:56
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Here is my form
<form action="" method="POST" id="f1">
<h3><I>GENERATE HERE !</I></h3>
<div class="row">
<div class="col-25">
<label for="qnum">Select no.of questions:</label>
</div>
<div class = "col-75"><input type="number" id="qnum" name="que" value="1" min="1" max="100"></div>
<br /><br />
</div>
<br />
<div class="row">
<div class="col-25">
<label for="int">Select no. of Integers:</label></div>
<div class="col-75">
<select name="select" id="int">
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-25">
<label for="dig">Select no. of digits:</label></div>
<div class="col-75">
<select name="digits" id="dig">
<option value="1"> 1 digit</option>
</select>
</div>
<br /><br /><br /><br />
</div>
<div class="row">
<div class="col-25"><label>Select operations:</label><br /></div>
<div class="col-75">
<input type="checkbox" id="mix" value="all" class="toggle-button"><label>All</label>
<input type="checkbox" id="add" name="operation" value="Addition" checked><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="Subtraction"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="Multiplication"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="Division"><label>Division</label>
</div>
<br /><br />
<br /><br />
</div><br />
<input type="submit" name="submit" value="Generate" id = "gen">
<button class="button btn1">Play</button><br>
<br />
</form>
</div>
<script>
$( '.col-75 .toggle-button' ).click( function () {
$( '.col-75 input[type="checkbox"]' ).prop('checked', this.checked)
})
</script>
Below is my php code which is working perfectly. My purpose is to hide the form on clicking play button.and then show the output of my code, how can I do that?
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit'])){
if($_POST['digits'] == 1){
$q = $_POST['que'];
$rOperators = array('+','-','*','/')
$previousInt = null; //Track the previous operand
$s = $_POST['select'];
for ($x = 1; $x<=$q; $x++){ //for loop for no. of questions
$randomOperands = array();
$randomOperators = array();
// loop over $i n times
for ($i = 1; $i <=$s; $i++){ //for loop for no. of integers user entered
$nextInt = rand(1, 9); // assign random operand to array slot
$randomOperands = $nextInt;
if($i < $s){
if($previousInt === 0) //No operator after last opearnd
{
//avoid division-by-zero
$randomOperators = $rOperators[rand(0, 2)];
}else{
$randomOperators = $rOperators[rand(0, $N-1)];
}
}
$previousInt = $nextInt;
}
// print array values
$exp = '';
$output_string = " ";
//Generating the expression
foreach($randomOperands as $key=>$value1){
$exp .= $value1 . "" ;
$output_string .= $value1. "<br>";
if(isset($randomOperators[$key])){
$exp .= $randomOperators[$key] ."";
$output_string .= $randomOperators[$key]."<br>";
}
}
//print expression
$res = eval("return ($exp);");//evaluate the expression
echo ("This is Q(".$x."): <br>"), $output_string. "<br>________<br>".$res."<br>";
}
}
}
?>
The output is generating perfectly fine. I ma just getting trouble in the functionality of hide the form on clicking play button and then show the output , so how can I do that?
php jquery html
Here is my form
<form action="" method="POST" id="f1">
<h3><I>GENERATE HERE !</I></h3>
<div class="row">
<div class="col-25">
<label for="qnum">Select no.of questions:</label>
</div>
<div class = "col-75"><input type="number" id="qnum" name="que" value="1" min="1" max="100"></div>
<br /><br />
</div>
<br />
<div class="row">
<div class="col-25">
<label for="int">Select no. of Integers:</label></div>
<div class="col-75">
<select name="select" id="int">
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-25">
<label for="dig">Select no. of digits:</label></div>
<div class="col-75">
<select name="digits" id="dig">
<option value="1"> 1 digit</option>
</select>
</div>
<br /><br /><br /><br />
</div>
<div class="row">
<div class="col-25"><label>Select operations:</label><br /></div>
<div class="col-75">
<input type="checkbox" id="mix" value="all" class="toggle-button"><label>All</label>
<input type="checkbox" id="add" name="operation" value="Addition" checked><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="Subtraction"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="Multiplication"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="Division"><label>Division</label>
</div>
<br /><br />
<br /><br />
</div><br />
<input type="submit" name="submit" value="Generate" id = "gen">
<button class="button btn1">Play</button><br>
<br />
</form>
</div>
<script>
$( '.col-75 .toggle-button' ).click( function () {
$( '.col-75 input[type="checkbox"]' ).prop('checked', this.checked)
})
</script>
Below is my php code which is working perfectly. My purpose is to hide the form on clicking play button.and then show the output of my code, how can I do that?
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit'])){
if($_POST['digits'] == 1){
$q = $_POST['que'];
$rOperators = array('+','-','*','/')
$previousInt = null; //Track the previous operand
$s = $_POST['select'];
for ($x = 1; $x<=$q; $x++){ //for loop for no. of questions
$randomOperands = array();
$randomOperators = array();
// loop over $i n times
for ($i = 1; $i <=$s; $i++){ //for loop for no. of integers user entered
$nextInt = rand(1, 9); // assign random operand to array slot
$randomOperands = $nextInt;
if($i < $s){
if($previousInt === 0) //No operator after last opearnd
{
//avoid division-by-zero
$randomOperators = $rOperators[rand(0, 2)];
}else{
$randomOperators = $rOperators[rand(0, $N-1)];
}
}
$previousInt = $nextInt;
}
// print array values
$exp = '';
$output_string = " ";
//Generating the expression
foreach($randomOperands as $key=>$value1){
$exp .= $value1 . "" ;
$output_string .= $value1. "<br>";
if(isset($randomOperators[$key])){
$exp .= $randomOperators[$key] ."";
$output_string .= $randomOperators[$key]."<br>";
}
}
//print expression
$res = eval("return ($exp);");//evaluate the expression
echo ("This is Q(".$x."): <br>"), $output_string. "<br>________<br>".$res."<br>";
}
}
}
?>
The output is generating perfectly fine. I ma just getting trouble in the functionality of hide the form on clicking play button and then show the output , so how can I do that?
php jquery html
php jquery html
edited Nov 20 at 11:59
RiggsFolly
69.3k1764109
69.3k1764109
asked Nov 20 at 11:53
user10625430
427
427
wrap the whole html form in a bigif(!isset($_POST['submit']))
. That way it will either show the form or the results.
– Dirk Scholten
Nov 20 at 11:56
add a comment |
wrap the whole html form in a bigif(!isset($_POST['submit']))
. That way it will either show the form or the results.
– Dirk Scholten
Nov 20 at 11:56
wrap the whole html form in a big
if(!isset($_POST['submit']))
. That way it will either show the form or the results.– Dirk Scholten
Nov 20 at 11:56
wrap the whole html form in a big
if(!isset($_POST['submit']))
. That way it will either show the form or the results.– Dirk Scholten
Nov 20 at 11:56
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
I hope this is the solution for your question. if not then feel free to share your feedback with me
$( '.col-75 .toggle-button' ).click( function () {
$( '.col-75 input[type="checkbox"]' ).prop('checked', this.checked)
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form action="" method="POST" id="f1">
<h3><I>GENERATE HERE !</I></h3>
<div class="row">
<div class="col-25">
<label for="qnum">Select no.of questions:</label>
</div>
<div class = "col-75"><input type="number" id="qnum" name="que" value="1" min="1" max="100"></div>
<br /><br />
</div>
<br />
<div class="row">
<div class="col-25">
<label for="int">Select no. of Integers:</label></div>
<div class="col-75">
<select name="select" id="int">
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-25">
<label for="dig">Select no. of digits:</label></div>
<div class="col-75">
<select name="digits" id="dig">
<option value="1"> 1 digit</option>
</select>
</div>
<br /><br /><br /><br />
</div>
<div class="row">
<div class="col-25"><label>Select operations:</label><br /></div>
<div class="col-75">
<input type="checkbox" id="mix" value="all" class="toggle-button"><label>All</label>
<input type="checkbox" id="add" name="operation" value="Addition" checked><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="Subtraction"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="Multiplication"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="Division"><label>Division</label>
</div>
<br /><br />
<br /><br />
</div><br />
<input type="submit" name="submit" value="Generate" id = "gen">
<button class="button btn1">Play</button><br>
<br />
</form>
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit'])){
?>
<script>
$("form").hide();
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>
<a href="javascript:;" onclick="location.reload()">Try again</a>
<br>
<?php
if($_POST['digits'] == 1){
$q = $_POST['que'];
$rOperators = array('+','-','*','/');
$previousInt = null; //Track the previous operand
$s = $_POST['select'];
for ($x = 1; $x<=$q; $x++){ //for loop for no. of questions
$randomOperands = array();
$randomOperators = array();
// loop over $i n times
for ($i = 1; $i <=$s; $i++){ //for loop for no. of integers user entered
$nextInt = rand(1, 9); // assign random operand to array slot
$randomOperands = $nextInt;
if($i < $s){
if($previousInt === 0) //No operator after last opearnd
{
//avoid division-by-zero
$randomOperators = $rOperators[rand(0, 2)];
}else{
$randomOperators = $rOperators[rand(0, $N-1)];
}
}
$previousInt = $nextInt;
}
// print array values
$exp = '';
$output_string = " ";
//Generating the expression
foreach($randomOperands as $key=>$value1){
$exp .= $value1 . "" ;
$output_string .= $value1. "<br>";
if(isset($randomOperators[$key])){
$exp .= $randomOperators[$key] ."";
$output_string .= $randomOperators[$key]."<br>";
}
}
//print expression
$res = eval("return ($exp);");//evaluate the expression
echo ("This is Q(".$x."): <br>"), $output_string. "<br>________<br>".$res."<br>";
}
}
}
?>
thanks buddy for your feedback
– Parvej Alam
Nov 20 at 12:50
hey thanks a lot its working .Actually I have other 2 issues I am trying but I am unable to solve it can you help me ? 1) The first issue is I have two buttons there one is Generate and other is Play , so what I am aiming to do that after filling the form user will click on generate button and after this ,output should be store in an array but not display untill user clicks play.So how can I do that ?
– user10625430
Nov 20 at 12:54
after submitting the form you can store the values in array and assign that array to session variable. when your will click the second button then get that sesion value and do whatever you want to do with your values..
– Parvej Alam
Nov 20 at 12:57
or use can also use cookies
– Parvej Alam
Nov 20 at 12:58
HeyThanks for the suggestion but Its still not working somehow, I am trying badly for this but still I am unable to fix it, can you show me how can I do it?
– user10625430
Nov 20 at 13:11
|
show 4 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53392450%2fhow-to-hide-the-html-form-and-then-show-the-output-after-clickin-on-submit-butto%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
I hope this is the solution for your question. if not then feel free to share your feedback with me
$( '.col-75 .toggle-button' ).click( function () {
$( '.col-75 input[type="checkbox"]' ).prop('checked', this.checked)
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form action="" method="POST" id="f1">
<h3><I>GENERATE HERE !</I></h3>
<div class="row">
<div class="col-25">
<label for="qnum">Select no.of questions:</label>
</div>
<div class = "col-75"><input type="number" id="qnum" name="que" value="1" min="1" max="100"></div>
<br /><br />
</div>
<br />
<div class="row">
<div class="col-25">
<label for="int">Select no. of Integers:</label></div>
<div class="col-75">
<select name="select" id="int">
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-25">
<label for="dig">Select no. of digits:</label></div>
<div class="col-75">
<select name="digits" id="dig">
<option value="1"> 1 digit</option>
</select>
</div>
<br /><br /><br /><br />
</div>
<div class="row">
<div class="col-25"><label>Select operations:</label><br /></div>
<div class="col-75">
<input type="checkbox" id="mix" value="all" class="toggle-button"><label>All</label>
<input type="checkbox" id="add" name="operation" value="Addition" checked><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="Subtraction"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="Multiplication"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="Division"><label>Division</label>
</div>
<br /><br />
<br /><br />
</div><br />
<input type="submit" name="submit" value="Generate" id = "gen">
<button class="button btn1">Play</button><br>
<br />
</form>
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit'])){
?>
<script>
$("form").hide();
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>
<a href="javascript:;" onclick="location.reload()">Try again</a>
<br>
<?php
if($_POST['digits'] == 1){
$q = $_POST['que'];
$rOperators = array('+','-','*','/');
$previousInt = null; //Track the previous operand
$s = $_POST['select'];
for ($x = 1; $x<=$q; $x++){ //for loop for no. of questions
$randomOperands = array();
$randomOperators = array();
// loop over $i n times
for ($i = 1; $i <=$s; $i++){ //for loop for no. of integers user entered
$nextInt = rand(1, 9); // assign random operand to array slot
$randomOperands = $nextInt;
if($i < $s){
if($previousInt === 0) //No operator after last opearnd
{
//avoid division-by-zero
$randomOperators = $rOperators[rand(0, 2)];
}else{
$randomOperators = $rOperators[rand(0, $N-1)];
}
}
$previousInt = $nextInt;
}
// print array values
$exp = '';
$output_string = " ";
//Generating the expression
foreach($randomOperands as $key=>$value1){
$exp .= $value1 . "" ;
$output_string .= $value1. "<br>";
if(isset($randomOperators[$key])){
$exp .= $randomOperators[$key] ."";
$output_string .= $randomOperators[$key]."<br>";
}
}
//print expression
$res = eval("return ($exp);");//evaluate the expression
echo ("This is Q(".$x."): <br>"), $output_string. "<br>________<br>".$res."<br>";
}
}
}
?>
thanks buddy for your feedback
– Parvej Alam
Nov 20 at 12:50
hey thanks a lot its working .Actually I have other 2 issues I am trying but I am unable to solve it can you help me ? 1) The first issue is I have two buttons there one is Generate and other is Play , so what I am aiming to do that after filling the form user will click on generate button and after this ,output should be store in an array but not display untill user clicks play.So how can I do that ?
– user10625430
Nov 20 at 12:54
after submitting the form you can store the values in array and assign that array to session variable. when your will click the second button then get that sesion value and do whatever you want to do with your values..
– Parvej Alam
Nov 20 at 12:57
or use can also use cookies
– Parvej Alam
Nov 20 at 12:58
HeyThanks for the suggestion but Its still not working somehow, I am trying badly for this but still I am unable to fix it, can you show me how can I do it?
– user10625430
Nov 20 at 13:11
|
show 4 more comments
up vote
0
down vote
accepted
I hope this is the solution for your question. if not then feel free to share your feedback with me
$( '.col-75 .toggle-button' ).click( function () {
$( '.col-75 input[type="checkbox"]' ).prop('checked', this.checked)
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form action="" method="POST" id="f1">
<h3><I>GENERATE HERE !</I></h3>
<div class="row">
<div class="col-25">
<label for="qnum">Select no.of questions:</label>
</div>
<div class = "col-75"><input type="number" id="qnum" name="que" value="1" min="1" max="100"></div>
<br /><br />
</div>
<br />
<div class="row">
<div class="col-25">
<label for="int">Select no. of Integers:</label></div>
<div class="col-75">
<select name="select" id="int">
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-25">
<label for="dig">Select no. of digits:</label></div>
<div class="col-75">
<select name="digits" id="dig">
<option value="1"> 1 digit</option>
</select>
</div>
<br /><br /><br /><br />
</div>
<div class="row">
<div class="col-25"><label>Select operations:</label><br /></div>
<div class="col-75">
<input type="checkbox" id="mix" value="all" class="toggle-button"><label>All</label>
<input type="checkbox" id="add" name="operation" value="Addition" checked><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="Subtraction"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="Multiplication"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="Division"><label>Division</label>
</div>
<br /><br />
<br /><br />
</div><br />
<input type="submit" name="submit" value="Generate" id = "gen">
<button class="button btn1">Play</button><br>
<br />
</form>
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit'])){
?>
<script>
$("form").hide();
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>
<a href="javascript:;" onclick="location.reload()">Try again</a>
<br>
<?php
if($_POST['digits'] == 1){
$q = $_POST['que'];
$rOperators = array('+','-','*','/');
$previousInt = null; //Track the previous operand
$s = $_POST['select'];
for ($x = 1; $x<=$q; $x++){ //for loop for no. of questions
$randomOperands = array();
$randomOperators = array();
// loop over $i n times
for ($i = 1; $i <=$s; $i++){ //for loop for no. of integers user entered
$nextInt = rand(1, 9); // assign random operand to array slot
$randomOperands = $nextInt;
if($i < $s){
if($previousInt === 0) //No operator after last opearnd
{
//avoid division-by-zero
$randomOperators = $rOperators[rand(0, 2)];
}else{
$randomOperators = $rOperators[rand(0, $N-1)];
}
}
$previousInt = $nextInt;
}
// print array values
$exp = '';
$output_string = " ";
//Generating the expression
foreach($randomOperands as $key=>$value1){
$exp .= $value1 . "" ;
$output_string .= $value1. "<br>";
if(isset($randomOperators[$key])){
$exp .= $randomOperators[$key] ."";
$output_string .= $randomOperators[$key]."<br>";
}
}
//print expression
$res = eval("return ($exp);");//evaluate the expression
echo ("This is Q(".$x."): <br>"), $output_string. "<br>________<br>".$res."<br>";
}
}
}
?>
thanks buddy for your feedback
– Parvej Alam
Nov 20 at 12:50
hey thanks a lot its working .Actually I have other 2 issues I am trying but I am unable to solve it can you help me ? 1) The first issue is I have two buttons there one is Generate and other is Play , so what I am aiming to do that after filling the form user will click on generate button and after this ,output should be store in an array but not display untill user clicks play.So how can I do that ?
– user10625430
Nov 20 at 12:54
after submitting the form you can store the values in array and assign that array to session variable. when your will click the second button then get that sesion value and do whatever you want to do with your values..
– Parvej Alam
Nov 20 at 12:57
or use can also use cookies
– Parvej Alam
Nov 20 at 12:58
HeyThanks for the suggestion but Its still not working somehow, I am trying badly for this but still I am unable to fix it, can you show me how can I do it?
– user10625430
Nov 20 at 13:11
|
show 4 more comments
up vote
0
down vote
accepted
up vote
0
down vote
accepted
I hope this is the solution for your question. if not then feel free to share your feedback with me
$( '.col-75 .toggle-button' ).click( function () {
$( '.col-75 input[type="checkbox"]' ).prop('checked', this.checked)
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form action="" method="POST" id="f1">
<h3><I>GENERATE HERE !</I></h3>
<div class="row">
<div class="col-25">
<label for="qnum">Select no.of questions:</label>
</div>
<div class = "col-75"><input type="number" id="qnum" name="que" value="1" min="1" max="100"></div>
<br /><br />
</div>
<br />
<div class="row">
<div class="col-25">
<label for="int">Select no. of Integers:</label></div>
<div class="col-75">
<select name="select" id="int">
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-25">
<label for="dig">Select no. of digits:</label></div>
<div class="col-75">
<select name="digits" id="dig">
<option value="1"> 1 digit</option>
</select>
</div>
<br /><br /><br /><br />
</div>
<div class="row">
<div class="col-25"><label>Select operations:</label><br /></div>
<div class="col-75">
<input type="checkbox" id="mix" value="all" class="toggle-button"><label>All</label>
<input type="checkbox" id="add" name="operation" value="Addition" checked><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="Subtraction"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="Multiplication"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="Division"><label>Division</label>
</div>
<br /><br />
<br /><br />
</div><br />
<input type="submit" name="submit" value="Generate" id = "gen">
<button class="button btn1">Play</button><br>
<br />
</form>
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit'])){
?>
<script>
$("form").hide();
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>
<a href="javascript:;" onclick="location.reload()">Try again</a>
<br>
<?php
if($_POST['digits'] == 1){
$q = $_POST['que'];
$rOperators = array('+','-','*','/');
$previousInt = null; //Track the previous operand
$s = $_POST['select'];
for ($x = 1; $x<=$q; $x++){ //for loop for no. of questions
$randomOperands = array();
$randomOperators = array();
// loop over $i n times
for ($i = 1; $i <=$s; $i++){ //for loop for no. of integers user entered
$nextInt = rand(1, 9); // assign random operand to array slot
$randomOperands = $nextInt;
if($i < $s){
if($previousInt === 0) //No operator after last opearnd
{
//avoid division-by-zero
$randomOperators = $rOperators[rand(0, 2)];
}else{
$randomOperators = $rOperators[rand(0, $N-1)];
}
}
$previousInt = $nextInt;
}
// print array values
$exp = '';
$output_string = " ";
//Generating the expression
foreach($randomOperands as $key=>$value1){
$exp .= $value1 . "" ;
$output_string .= $value1. "<br>";
if(isset($randomOperators[$key])){
$exp .= $randomOperators[$key] ."";
$output_string .= $randomOperators[$key]."<br>";
}
}
//print expression
$res = eval("return ($exp);");//evaluate the expression
echo ("This is Q(".$x."): <br>"), $output_string. "<br>________<br>".$res."<br>";
}
}
}
?>
I hope this is the solution for your question. if not then feel free to share your feedback with me
$( '.col-75 .toggle-button' ).click( function () {
$( '.col-75 input[type="checkbox"]' ).prop('checked', this.checked)
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form action="" method="POST" id="f1">
<h3><I>GENERATE HERE !</I></h3>
<div class="row">
<div class="col-25">
<label for="qnum">Select no.of questions:</label>
</div>
<div class = "col-75"><input type="number" id="qnum" name="que" value="1" min="1" max="100"></div>
<br /><br />
</div>
<br />
<div class="row">
<div class="col-25">
<label for="int">Select no. of Integers:</label></div>
<div class="col-75">
<select name="select" id="int">
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-25">
<label for="dig">Select no. of digits:</label></div>
<div class="col-75">
<select name="digits" id="dig">
<option value="1"> 1 digit</option>
</select>
</div>
<br /><br /><br /><br />
</div>
<div class="row">
<div class="col-25"><label>Select operations:</label><br /></div>
<div class="col-75">
<input type="checkbox" id="mix" value="all" class="toggle-button"><label>All</label>
<input type="checkbox" id="add" name="operation" value="Addition" checked><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="Subtraction"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="Multiplication"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="Division"><label>Division</label>
</div>
<br /><br />
<br /><br />
</div><br />
<input type="submit" name="submit" value="Generate" id = "gen">
<button class="button btn1">Play</button><br>
<br />
</form>
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit'])){
?>
<script>
$("form").hide();
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>
<a href="javascript:;" onclick="location.reload()">Try again</a>
<br>
<?php
if($_POST['digits'] == 1){
$q = $_POST['que'];
$rOperators = array('+','-','*','/');
$previousInt = null; //Track the previous operand
$s = $_POST['select'];
for ($x = 1; $x<=$q; $x++){ //for loop for no. of questions
$randomOperands = array();
$randomOperators = array();
// loop over $i n times
for ($i = 1; $i <=$s; $i++){ //for loop for no. of integers user entered
$nextInt = rand(1, 9); // assign random operand to array slot
$randomOperands = $nextInt;
if($i < $s){
if($previousInt === 0) //No operator after last opearnd
{
//avoid division-by-zero
$randomOperators = $rOperators[rand(0, 2)];
}else{
$randomOperators = $rOperators[rand(0, $N-1)];
}
}
$previousInt = $nextInt;
}
// print array values
$exp = '';
$output_string = " ";
//Generating the expression
foreach($randomOperands as $key=>$value1){
$exp .= $value1 . "" ;
$output_string .= $value1. "<br>";
if(isset($randomOperators[$key])){
$exp .= $randomOperators[$key] ."";
$output_string .= $randomOperators[$key]."<br>";
}
}
//print expression
$res = eval("return ($exp);");//evaluate the expression
echo ("This is Q(".$x."): <br>"), $output_string. "<br>________<br>".$res."<br>";
}
}
}
?>
$( '.col-75 .toggle-button' ).click( function () {
$( '.col-75 input[type="checkbox"]' ).prop('checked', this.checked)
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form action="" method="POST" id="f1">
<h3><I>GENERATE HERE !</I></h3>
<div class="row">
<div class="col-25">
<label for="qnum">Select no.of questions:</label>
</div>
<div class = "col-75"><input type="number" id="qnum" name="que" value="1" min="1" max="100"></div>
<br /><br />
</div>
<br />
<div class="row">
<div class="col-25">
<label for="int">Select no. of Integers:</label></div>
<div class="col-75">
<select name="select" id="int">
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-25">
<label for="dig">Select no. of digits:</label></div>
<div class="col-75">
<select name="digits" id="dig">
<option value="1"> 1 digit</option>
</select>
</div>
<br /><br /><br /><br />
</div>
<div class="row">
<div class="col-25"><label>Select operations:</label><br /></div>
<div class="col-75">
<input type="checkbox" id="mix" value="all" class="toggle-button"><label>All</label>
<input type="checkbox" id="add" name="operation" value="Addition" checked><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="Subtraction"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="Multiplication"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="Division"><label>Division</label>
</div>
<br /><br />
<br /><br />
</div><br />
<input type="submit" name="submit" value="Generate" id = "gen">
<button class="button btn1">Play</button><br>
<br />
</form>
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit'])){
?>
<script>
$("form").hide();
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>
<a href="javascript:;" onclick="location.reload()">Try again</a>
<br>
<?php
if($_POST['digits'] == 1){
$q = $_POST['que'];
$rOperators = array('+','-','*','/');
$previousInt = null; //Track the previous operand
$s = $_POST['select'];
for ($x = 1; $x<=$q; $x++){ //for loop for no. of questions
$randomOperands = array();
$randomOperators = array();
// loop over $i n times
for ($i = 1; $i <=$s; $i++){ //for loop for no. of integers user entered
$nextInt = rand(1, 9); // assign random operand to array slot
$randomOperands = $nextInt;
if($i < $s){
if($previousInt === 0) //No operator after last opearnd
{
//avoid division-by-zero
$randomOperators = $rOperators[rand(0, 2)];
}else{
$randomOperators = $rOperators[rand(0, $N-1)];
}
}
$previousInt = $nextInt;
}
// print array values
$exp = '';
$output_string = " ";
//Generating the expression
foreach($randomOperands as $key=>$value1){
$exp .= $value1 . "" ;
$output_string .= $value1. "<br>";
if(isset($randomOperators[$key])){
$exp .= $randomOperators[$key] ."";
$output_string .= $randomOperators[$key]."<br>";
}
}
//print expression
$res = eval("return ($exp);");//evaluate the expression
echo ("This is Q(".$x."): <br>"), $output_string. "<br>________<br>".$res."<br>";
}
}
}
?>
$( '.col-75 .toggle-button' ).click( function () {
$( '.col-75 input[type="checkbox"]' ).prop('checked', this.checked)
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form action="" method="POST" id="f1">
<h3><I>GENERATE HERE !</I></h3>
<div class="row">
<div class="col-25">
<label for="qnum">Select no.of questions:</label>
</div>
<div class = "col-75"><input type="number" id="qnum" name="que" value="1" min="1" max="100"></div>
<br /><br />
</div>
<br />
<div class="row">
<div class="col-25">
<label for="int">Select no. of Integers:</label></div>
<div class="col-75">
<select name="select" id="int">
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-25">
<label for="dig">Select no. of digits:</label></div>
<div class="col-75">
<select name="digits" id="dig">
<option value="1"> 1 digit</option>
</select>
</div>
<br /><br /><br /><br />
</div>
<div class="row">
<div class="col-25"><label>Select operations:</label><br /></div>
<div class="col-75">
<input type="checkbox" id="mix" value="all" class="toggle-button"><label>All</label>
<input type="checkbox" id="add" name="operation" value="Addition" checked><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="Subtraction"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="Multiplication"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="Division"><label>Division</label>
</div>
<br /><br />
<br /><br />
</div><br />
<input type="submit" name="submit" value="Generate" id = "gen">
<button class="button btn1">Play</button><br>
<br />
</form>
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_POST['submit'])){
?>
<script>
$("form").hide();
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>
<a href="javascript:;" onclick="location.reload()">Try again</a>
<br>
<?php
if($_POST['digits'] == 1){
$q = $_POST['que'];
$rOperators = array('+','-','*','/');
$previousInt = null; //Track the previous operand
$s = $_POST['select'];
for ($x = 1; $x<=$q; $x++){ //for loop for no. of questions
$randomOperands = array();
$randomOperators = array();
// loop over $i n times
for ($i = 1; $i <=$s; $i++){ //for loop for no. of integers user entered
$nextInt = rand(1, 9); // assign random operand to array slot
$randomOperands = $nextInt;
if($i < $s){
if($previousInt === 0) //No operator after last opearnd
{
//avoid division-by-zero
$randomOperators = $rOperators[rand(0, 2)];
}else{
$randomOperators = $rOperators[rand(0, $N-1)];
}
}
$previousInt = $nextInt;
}
// print array values
$exp = '';
$output_string = " ";
//Generating the expression
foreach($randomOperands as $key=>$value1){
$exp .= $value1 . "" ;
$output_string .= $value1. "<br>";
if(isset($randomOperators[$key])){
$exp .= $randomOperators[$key] ."";
$output_string .= $randomOperators[$key]."<br>";
}
}
//print expression
$res = eval("return ($exp);");//evaluate the expression
echo ("This is Q(".$x."): <br>"), $output_string. "<br>________<br>".$res."<br>";
}
}
}
?>
edited Nov 20 at 12:42
answered Nov 20 at 12:25
Parvej Alam
1865
1865
thanks buddy for your feedback
– Parvej Alam
Nov 20 at 12:50
hey thanks a lot its working .Actually I have other 2 issues I am trying but I am unable to solve it can you help me ? 1) The first issue is I have two buttons there one is Generate and other is Play , so what I am aiming to do that after filling the form user will click on generate button and after this ,output should be store in an array but not display untill user clicks play.So how can I do that ?
– user10625430
Nov 20 at 12:54
after submitting the form you can store the values in array and assign that array to session variable. when your will click the second button then get that sesion value and do whatever you want to do with your values..
– Parvej Alam
Nov 20 at 12:57
or use can also use cookies
– Parvej Alam
Nov 20 at 12:58
HeyThanks for the suggestion but Its still not working somehow, I am trying badly for this but still I am unable to fix it, can you show me how can I do it?
– user10625430
Nov 20 at 13:11
|
show 4 more comments
thanks buddy for your feedback
– Parvej Alam
Nov 20 at 12:50
hey thanks a lot its working .Actually I have other 2 issues I am trying but I am unable to solve it can you help me ? 1) The first issue is I have two buttons there one is Generate and other is Play , so what I am aiming to do that after filling the form user will click on generate button and after this ,output should be store in an array but not display untill user clicks play.So how can I do that ?
– user10625430
Nov 20 at 12:54
after submitting the form you can store the values in array and assign that array to session variable. when your will click the second button then get that sesion value and do whatever you want to do with your values..
– Parvej Alam
Nov 20 at 12:57
or use can also use cookies
– Parvej Alam
Nov 20 at 12:58
HeyThanks for the suggestion but Its still not working somehow, I am trying badly for this but still I am unable to fix it, can you show me how can I do it?
– user10625430
Nov 20 at 13:11
thanks buddy for your feedback
– Parvej Alam
Nov 20 at 12:50
thanks buddy for your feedback
– Parvej Alam
Nov 20 at 12:50
hey thanks a lot its working .Actually I have other 2 issues I am trying but I am unable to solve it can you help me ? 1) The first issue is I have two buttons there one is Generate and other is Play , so what I am aiming to do that after filling the form user will click on generate button and after this ,output should be store in an array but not display untill user clicks play.So how can I do that ?
– user10625430
Nov 20 at 12:54
hey thanks a lot its working .Actually I have other 2 issues I am trying but I am unable to solve it can you help me ? 1) The first issue is I have two buttons there one is Generate and other is Play , so what I am aiming to do that after filling the form user will click on generate button and after this ,output should be store in an array but not display untill user clicks play.So how can I do that ?
– user10625430
Nov 20 at 12:54
after submitting the form you can store the values in array and assign that array to session variable. when your will click the second button then get that sesion value and do whatever you want to do with your values..
– Parvej Alam
Nov 20 at 12:57
after submitting the form you can store the values in array and assign that array to session variable. when your will click the second button then get that sesion value and do whatever you want to do with your values..
– Parvej Alam
Nov 20 at 12:57
or use can also use cookies
– Parvej Alam
Nov 20 at 12:58
or use can also use cookies
– Parvej Alam
Nov 20 at 12:58
HeyThanks for the suggestion but Its still not working somehow, I am trying badly for this but still I am unable to fix it, can you show me how can I do it?
– user10625430
Nov 20 at 13:11
HeyThanks for the suggestion but Its still not working somehow, I am trying badly for this but still I am unable to fix it, can you show me how can I do it?
– user10625430
Nov 20 at 13:11
|
show 4 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53392450%2fhow-to-hide-the-html-form-and-then-show-the-output-after-clickin-on-submit-butto%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
wrap the whole html form in a big
if(!isset($_POST['submit']))
. That way it will either show the form or the results.– Dirk Scholten
Nov 20 at 11:56