Viewing file: mpclass3.php (7.37 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include('session.php'); ?> <?php include('connect.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"> <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> <td width="100%" > <h3><Hint></h3> <br> </div> <p hidden id="demo" ></p> <p hidden id="demo1" ></p> <p hidden id="demo2"> </p> <p id="demo3"></p> <form id='f1'> <?php // Get the search variable from URL
$var = @$_GET['ID'] ; $trimmed = trim($var); //trim whitespace from the stored variable
// rows to return $limit=1;
// check for an empty string and display a message.
//connect to your database ** EDIT REQUIRED HERE **
// Build SQL Query $query = "select * from mpclass3 order by rand() "; // EDIT HERE and specify your table and field names for the SQL query
$numresults=mysql_query($query); $numrows=mysql_num_rows($numresults);
// If we have no results, offer a google search as an alternative
if ($numrows == 0) { echo " Sorry, $trimmed this Number is not found";
}
// next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; }
// get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); $srno=0;
// begin to show results set
$count = 1 + $s ;
// now you can display the results returned while ($row= mysql_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>"; $count++ ; } $currPage = (($s/$limit) + 1);
//break before paging echo "";
// next we need to do the links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print "<a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a> "; }
// calculate number of pages needing links $pages=intval($numrows/$limit);
// $pages now contains int of pages needed unless there is a remainder from division
$nextid=$IDS+1; echo "<a href='mpclass3.php?ID=".$nextid."'><h2>Next</h2> </a>";
?>
<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>
|