Dear friends,
With 4 radio buttons and php snippet, it gives desired output, however when I
add second question in the html form and variable for the same like
$variable =$_POST['q'] in Php snippet
it gives me error.
I have pasted php code when it works and when it gives error.
Any guidance, please.
----------------------------------------------------------------------
Error
------------------------------------------------------------------------------
---
Parse error: parse error, unexpected ',' in C:\HOME\doctorbush\quiz.php on
line 10
------------------------------------------------------------------------------
-
php snnipet, code which it works with Q-1
-----------------------------------------------------------------------
<?php
$variable = $_POST['R'] ;
if ($variable == 3) {
echo "Score 1;
}
else {
echo "Score 0";
};
?>
--------------------------------------
php snippet when it gives error with addition of second question
----------------------------------------------------------------------------
<?php
$variable = $_POST['R'] ;
$secondvar = $_POST['q'] ;
if ($variable == 3, $secondvar== 4) {
echo "Score 1;
}
else {
echo "Score 0";
?>
------------------------------------------------------------------
Html form code
---------------------------------------------------------------------------
<html>
<head>
<title></title>
</head>
<body>
<form method="POST" action="quiz.php">
Q-1)Law of diminished return is ;<br>
<input type="radio" value="4" checked name="R">
Medical concept <BR>
<input type="radio" value="3" checked name="R">
Economic <BR>
<input type="radio" value="2" checked name="R"> Agriculture <BR>
<input type="radio" value="1" checked name="R"> Computers <BR>
<p>
Q-2)Once there is inflation ;<br>
<input type="radio" value="4" checked name="q">
Government has to print extra currency <BR>
<input type="radio" value="3" checked name="q">
Inflation is good for economy <BR>
<input type="radio" value="2" checked name="q">
Inflation is diastrous for economy <BR>
<input type="radio" value="1" checked name="q">
Inflation is not of much concern <BR>
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="See Score">
</form></body>
</html>