Viewing file: gk.php (7.74 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include('session.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta charset="utf-8">
<title><?php include 'title.php'; ?></title> <style> .box{ color: #fff; padding: 20px; display: none; margin-top: 20px; } .option1{ background: #228B22; } .option2{ background: #ff0000; } .option3{ background: #ff0000; } .option4{ background: #ff0000; } label{ margin-right: 15px; } </style> <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
</head>
<body>
<table width="100%" border="0" cellspacing="2" bgcolor="#999999"> <tbody> <tr> <td colspan="3" bgcolor="#CCCCCC"> <?php include('menubar/menubar.php'); ?></td> </tr> <tr> <td colspan="3" bgcolor="#CCCCCC"> <?php include('sessionbar.php'); ?></td> </tr> <tr> <td align="left" valign="top" bgcolor="#FFFFFF">
</td> </tr> <tr> <td align="left" valign="top" bgcolor="#FFFFFF"> <form id="form1" name="form1" action="" method="POST" enctype="multipart/form-datas"> <table width="100%" border="0" cellspacing="0"> <tbody> <tr> <?php $keywords = $_GET['ID']; /* Attempt MySQL server connection. Assuming you are running MySQL server with default setting (user 'root' with no password) */ $link = mysqli_connect("localhost", "rcgi_examuser", "rb!exa838", "rcgi_examdata"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } $tetphyschologyserial=0; // Attempt select query execution $sql = "SELECT * FROM tetpsyocology where tet_paper_code='GK' "; if($result = mysqli_query($link, $sql)){ if(mysqli_num_rows($result) > 0){ while($row = mysqli_fetch_array($result)){ $tetphyschologyserial=$tetphyschologyserial+1;
} // Free result set mysqli_free_result($result); } else{ } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // Close connection mysqli_close($link); ?> <td width="100%" > <h3><Hint></h3> <br> </div> Total Question: <?php echo $tetphyschologyserial ?> <p hidden id="demo" ></p> <p hidden id="demo1" ></p> <p hidden id="demo2"> </p> <p id="demo3"></p> <form id='f1'> <?php /* Attempt MySQL server connection. Assuming you are running MySQL server with default setting (user 'root' with no password) */ $link = mysqli_connect("localhost", "rcgi_examuser", "rb!exa838", "rcgi_examdata"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Attempt select query execution $sql = "SELECT * FROM tetpsyocology where tet_paper_code='GK' order by rand() LIMIT 1 "; if($result = mysqli_query($link, $sql)){ if(mysqli_num_rows($result) > 0){ while($row = mysqli_fetch_array($result)){ $new_string1=$row[correctanswer]; $answer=$new_string1; $ids=$row[ID]; $IDS=$row[ID]; $srno=$srno+1; echo $ID; $texthnt='txtHint'.$srno; $option1= $ids.','.$row[wronganswer1]; $option2= $ids.','.$row[wronganswer2]; $option3= $ids.','.$row[wronganswer3]; $option4= $ids.','.$row[wronganswer4]; //set value of alert $optvalue1=$row[wronganswer1]; $optvalue2=$row[wronganswer2]; $optvalue3=$row[wronganswer3]; $optvalue4=$row[wronganswer4]; $questions=$row[question]; $trimvalue1=$row[wronganswer1]; $trimvalue2=$row[wronganswer2]; $trimvalue3=$row[wronganswer3]; $trimvalue4=$row[wronganswer4]; echo "</div>\n"; echo " <div class=\"col-md-4\"><div id='t1' style=\"position:absolute;\"></div></div>\n"; echo "</div>\n"; echo "<br>";
echo "<br>"; echo " <table width=\"100%\" border=\"0\" align='left' id='table' style='table-layout:fixed' cellspacing='10' cellpadding='10' >\n"; echo " <tr width='100%' cellspacing='10' cellpadding='10' height='50'>\n"; echo " <td bgcolor='#DADADA'><h3><b>$questions</b></h3></td>\n"; echo " </tr>\n"; echo " </table>\n";
echo " <table width=\"100%\" border=\"0\" align='left' id='table' style='table-layout:fixed' cellspacing='10' cellpadding='10'>\n"; echo " <tr width='100%' cellspacing='5'>\n"; echo " <td align='left' width='50%'>$row[wronganswer1]</td>\n"; echo " <td align='left' width='50%'><label for='opt1' class='lb'></label> <input class='wrongans' type=\"radio\" name='radiocount[$srno]' id=\"radiocount[$srno]\" value='a'/> <br> </td>\n"; echo " </tr>\n";
echo " <tr>\n"; echo " <td align='left' width='90%'>$row[wronganswer2] </td>\n"; echo " <td align='left'> <label for='opt2' class='lb'></label>
<input class='wrongans' type=\"radio\" name='radiocount[$srno]' id=\"radiocount[$srno]\" value='b'/> <br> </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align='left' width='90%'>$row[wronganswer3] </td>\n"; echo " <td align='left'> <label for='opt3' class='lb'></label>
<input class='wrongans' type=\"radio\" name=\"radiocount[$srno]\" id=\"radiocount[$srno]\" value='c'/> <br> </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align='left' width='90%'>$row[wronganswer4] </td>\n"; echo " <td align='left'> <label for='opt4' class='lb'></label>
<input class='wrongans' type=\"radio\" name=\"radiocount[$srno]\" id=\"radiocount[$srno]\" value='d' /> </td>\n";
echo " </tr>\n"; echo " <tr>\n"; echo " <td> </td>\n"; echo " <td><input type=\"hidden\" name='cans[$srno]' id=\"cans\" value='$row[correctanswer]'/>
<input type=\"hidden\" name='countss' id=\"countss\" value='$srno' /> <input type=\"hidden\" name='rollnos' id=\"countss\" value='$rollnoss' /> </td>\n";
echo " </tr>\n"; echo " </table>
</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo "<hr></hr>"; echo "<br>"; } // Free result set mysqli_free_result($result); } else{ echo "No records matching your query were found."; } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } $nextid=$IDS+1; echo "<a href='gk.php?ID=".$nextid."'><h2>Next</h2> </a>"; // Close connection mysqli_close($link); ?>
<script>
$(document).ready(function () {
$(".wrongans").change(function () {
var val =$('.wrongans:checked').val(); var n = val.length; document.getElementById("demo").innerHTML = n ;
var str ='<?php echo $answer ?>'; var s = str.length; document.getElementById("demo1").innerHTML =s;
if(val==str) { document.getElementById("demo3").innerHTML = "<b><h2><font color=green>आपका उत्तर सही है</font></b></h1> "; } else { document.getElementById("demo3").innerHTML = "<b><h2><font color=red>आपका उत्तर गलत है </font></b></h1>"; }
}); }); </script> </form> </td> </tr> <tr> <td align="left" valign="top"> </td> <td bgcolor="#FFFFFF"></td> </tr> </tbody></form> </table></td> </tr> <tr> <td bgcolor="#FFFFFF"></td> </tr> <tr> <td height="50" bgcolor="#999999"></td> </tr> </tbody> </table> <?php include 'footer.php'; ?>
</body> </html>
|