Viewing file: gallery.php (5.39 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<!DOCTYPE html> <html> <?php include('session.php'); ?> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no"> <title>Question Paper</title> <link rel="stylesheet" href="gallery/assets/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.2/dist/jquery.fancybox.min.css"> <link rel="stylesheet" href="gallery/assets/css/Basic-fancyBox-Gallery-v2.css"> <link rel="stylesheet" href="gallery/assets/css/styles.css"> <script> var newstrng = "<?php echo $texthnt; ?>"; document.getElementById("demo").innerHTML = 5+7; function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (this.readyState==4 && this.status==200) { document.getElementById("newstrng").innerHTML=this.responseText; } } xmlhttp.open("GET","getuser.php?q="+str,true); xmlhttp.send(); }</script> </head> <?php include '..connect.php';?> <?php include 'divider/divider.php';?>
<body> <div class="container"> <div class="row fbox3"> <?php // Get the search variable from URL
$var = 1 ; $trimmed = trim($var); //trim whitespace from the stored variable 1 // rows to return $limit=10000;
// check for an empty string and display a message.
//connect to your database ** EDIT REQUIRED HERE **
// Build SQL Query $query = "select * from ctet_physcology"; // 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)) { $answer=$row[correctanswer]; $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]; echo " <table width=\"100%\" border=\"0\" align='left' id='table' style='table-layout:fixed' >\n"; echo " <tr>\n"; echo " <td width=\"100%\"><b><h5>$row[question]</b></h5></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td width='600' align='left'>
<table border=\"0\" align='left' width='100%' style='table-layout:fixed'>\n"; echo " <tr>\n"; echo " <td align='left' width='90%'>$row[wronganswer1]</td>\n"; echo " <td align='left' width='10%'><input type=\"radio\" name='$texthnt' id=\"$texthnt\" value='$option1' onchange='showUser(this.value)' /></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align='left' width='90%'>$row[wronganswer2] </td>\n"; echo " <td align='left'><input type=\"radio\" name='$texthnt' id=\"$texthnt\" value='$option2' onchange='showUser(this.value)' /></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align='left' width='90%'>$row[wronganswer3] </td>\n"; echo " <td align='left'><input type=\"radio\" name=\"$texthnt\" id=\"$texthnt\" value='$option3' onchange='showUser(this.value)' /></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align='left' width='90%'>$row[wronganswer4] </td>\n"; echo " <td align='left'><input type=\"radio\" name=\"$texthnt\" id=\"$texthnt\" value='$option4' onchange='showUser(this.value)' /></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='ccc-first-test.php?ID=" .$nextid. "'><h2>Next</h2> </a>";
?>
</div> </div>
<script src="gallery/assets/js/jquery.min.js"></script> <script src="gallery/assets/bootstrap/js/bootstrap.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.2/dist/jquery.fancybox.min.js"></script> </body>
</html>
|