What's new

Closed How to display the total number of correct answer

Status
Not open for further replies.

URLx01

Honorary Poster
Established
Joined
Apr 24, 2017
Posts
309
Reaction
228
Points
179
how to display the total number of correct answer using php?

eto po yung code ko

heres my code .




<!DOCTYPE html>
<html>
<body>


<form method="POST">

<p>1.A symbol which indicates a variable declaration. </p>

<input type="radio" name="one" value="Dollar">Dollar<br>
<input type="radio" name="one" value="asterisk">Asterisk <br>
<input type="radio" name="one" value="colon">Colon<br>
<input type="radio" name="one" value="semi">Semi-colon<br>

<br>


<p>2.HTML stands for ____.</p>

<input type="radio" name="two" value="Hyper">Hyper Text Markup Language <br>
<input type="radio" name="two" value="Hypertext Markup Language" required>Hypertext Markup Language <br>
<input type="radio" name="two" value=" Hyper Text Mark up Language">Hyper Text Mark up Language<br>
<input type="radio" name="two" value=" Hyper Text Mark Language">Hyper Text Mark Language <br>

<p>3.PHP now stands for ___.</p>

<input type="radio" name="three" value="Personal Home Page">Personal Home Page<br>
<input type="radio" name="three" value="Hypertext Pre-processor">Hypertext Pre-processor<br>

<p>4.PHP is a ___ scripting language.</p>

<input type="radio" name="four" value="Server side">Server side<br>
<input type="radio" name="four" value="Client side">Client side<br>


<p>5.echo and print are both functions.</p>

<input type="radio" name="five" value="Yes">Yes<br>
<input type="radio" name="five" value="No">No<br>


<p>6.This represent a variable with no value.</p>

<input type="radio" name="six" value="link">link<br>
<input type="radio" name="six" value="empty">empty<br>
<input type="radio" name="six" value="null">null<br>
<input type="radio" name="six" value="void">void<br>

<p>7.It is the instance of a class.</p>

<input type="radio" name="seven" value="resource">resource<br>
<input type="radio" name="seven" value="container">container<br>
<input type="radio" name="seven" value="variable">variable<br>
<input type="radio" name="seven" value="object">object<br>

<p>8.Multi line comments starts with __ and ends with __.</p>

<input type="radio" name="eight" value="//">//<br>
<input type="radio" name="eight" value="//">//<br>
<input type="radio" name="eight" value="//">//<br>
<input type="radio" name="eight" value="//">//<br>

<p>9.Rasmus Lerdorf didn't designed PHP to used as some programming language. It was just develop to manage _.</p>

<input type="radio" name="nine" value="his personal information">his personal information<br>
<input type="radio" name="nine" value="his families secret">his families secret<br>
<input type="radio" name="nine" value="hi personal site">his personal site<br>
<input type="radio" name="nine" value="his personal website">his personal website<br>

<p>10.We can't use PHP in all the major operating system inclusive of Microsoft Windows, Linux, Mac OS and XRISC OS.</p>

<input type="radio" name="ten" value="No">No<br>
<input type="radio" name="ten" value="Yes">Yes<br>


<br>
<input type="submit" name="sub"
value="Submit">

</form>
</body>
</html>


<?php
ERROR_REPORTING(~E_NOTICE);



if($_POST["sub"]=="Submit")
{
if($_POST["one"]=="Dollar")
{
$ans=$_POST["one"];
echo"<br>Your answer &nbsp;"
.$ans. " is correct!";

}
else
{
$ans=$_POST["one"];
echo"<br>Your answer &nbsp;"
.$ans. " is wrong!";

}
}

if($_POST["sub"]=="Submit")
{
if($_POST["two"]=="Hypertext Markup Language")
{
$ans=$_POST["two"];
echo"<br>Your answer &nbsp;"
.$ans. " is correct!";

}
else{
$ans=$_POST["two"];
echo"<br>Your answer &nbsp;"
.$ans. " is wrong! ";
}
}

if($_POST["sub"]=="Submit")
{
if($_POST["three"]=="Hypertext Pre-processor")
{
$ans=$_POST["three"];
echo"<br>Your answer &nbsp;"
.$ans. " is correct!";

}
else
{
$ans=$_POST["three"];
echo"<br>Your answer &nbsp;"
.$ans. " is wrong!";

}
}

if($_POST["sub"]=="Submit")
{
if($_POST["four"]=="Server side")
{
$ans=$_POST["four"];
echo"<br>Your answer &nbsp;"
.$ans. " is correct!";

}
else
{
$ans=$_POST["four"];
echo"<br>Your answer &nbsp;"
.$ans. " is wrong!";

}
}


if($_POST["sub"]=="Submit")
{
if($_POST["five"]=="No")
{
$ans=$_POST["five"];
echo"<br>Your answer &nbsp;"
.$ans. " is correct!";

}
else
{
$ans=$_POST["five"];
echo"<br>Your answer &nbsp;"
.$ans. " is wrong!";

}
}

if($_POST["sub"]=="Submit")
{
if($_POST["six"]=="null")
{
$ans=$_POST["six"];
echo"<br>Your answer &nbsp;"
.$ans. " is correct!";

}
else
{
$ans=$_POST["six"];
echo"<br>Your answer &nbsp;"
.$ans. " is wrong!";

}
}

if($_POST["sub"]=="Submit")
{
if($_POST["seven"]=="object")
{
$ans=$_POST["seven"];
echo"<br>Your answer &nbsp;"
.$ans. " is correct!";

}
else
{
$ans=$_POST["seven"];
echo"<br>Your answer &nbsp;"
.$ans. " is wrong!";

}
}

if($_POST["sub"]=="Submit")
{
if($_POST["eight"]=="/**/")
{
$ans=$_POST["eight"];
echo"<br>Your answer &nbsp;"
.$ans. " is correct!";

}
else
{
$ans=$_POST["eight"];
echo"<br>Your answer &nbsp;"
.$ans. " is wrong!";

}
}


if($_POST["sub"]=="Submit")
{
if($_POST["nine"]=="his personal website")
{
$ans=$_POST["nine"];
echo"<br>Your answer &nbsp;"
.$ans. " is correct!";

}
else
{
$ans=$_POST["nine"];
echo"<br>Your answer &nbsp;"
.$ans. " is wrong!";

}
}

if($_POST["sub"]=="Submit")
{
if($_POST["ten"]=="No")
{
$ans=$_POST["ten"];
echo"<br>Your answer &nbsp;"
.$ans. " is correct!";

}
else
{
$ans=$_POST["ten"];
echo"<br>Your answer &nbsp;"
.$ans. " is wrong!";

}
}



?>
 
Dapat ginawa mo na lang attachment file sir hehe.
Btw, anung gusto mong process ng posting? thru php ba or jquery/ajax?

UPDATE :
Ay, di ko binasa buong code mo hehe.
So,on submit pala.
Wait gawan kita hehe, lagyan ko na din explanation :)
 
Status
Not open for further replies.

Similar threads

Back
Top