日期:2014-05-17 浏览次数:20488 次
<?php $strConn="odbc:driver={microsoft access driver (*.mdb)};dbq=".realpath("db.mdb"); $conn = new PDO($strConn); if($_POST["tj"]=="交卷"){ //求成绩和 exit(); } ?> <form action='' method="post"> <table id="t2" width="100%" border="0" align="left" cellpadding="0" cellspacing="1" bgcolor="#EFEFEF" style="text-align:left;"> <?php for($i=1;$i<=8;$i++){ $y=mt_rand(1,20); $dsn = $conn->query('select * from st where id='.$y); $row = $dsn->fetch(); $str=$row['daan']; $q=explode("|",$str); echo '<tr>'; echo '<td height="25" colspan="2" bgcolor="#FFFFFF" style="padding-left:10px;">'; echo $i.'.'.$row['s_name'].'<br />'; echo '<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">'; echo '<tr><td><ul>'; echo '<input type="hidden" name="act" value="'.$row['id'].'">'; echo '<li><input type="radio" name="q'.$i.'" value="A" />'.$q[0].'</li>'; echo '<li><input type="radio" name="q'.$i.'" value="B" />'.$q[1].'</li>'; echo '<li><input type="radio" name="q'.$i.'" value="C" />'.$q[2].'</li>'; echo '<li><input type="radio" name="q'.$i.'" value="D" />'.$q[3].'</li></ul></td>'; echo '</tr>'; echo '</table></td>'; echo '</tr>'; } ?> <input type="submit" name="tj" value="交卷"/> </table> </form>