那个text框居然是记时的~~//汗~~这样的打分程序我想就只能用50个if then来做~~

解决方案 »

  1.   

    zxyufan(宇凡)你也真有耐心,50个if then.呵呵!
      

  2.   

    标准答案写成一个文本文件.然后和你作得答案比较.(我想得,没有试过哈)得出分数.不过我看到有人没有用php,就是用了js也可以实现打分得功能的.
      

  3.   

    数组做个循环就行了!或者用数据库(够easy了吧),即时用javascript当触发form.submit()事件时把时间一起提交上去!
      

  4.   

    设置一个变量,作为分数变量,如sum,然后对每道题进行判断.如果对,就sum=sum+10.
    具体代码我想不难写,我想是要用数据库的把这些题目,和答案都写到数据库里,如果不用,我想代码的工作量就太大了.
      

  5.   

    我給妳一個于數据庫連接的:
    建表:
    <?php
    require "config.php3";
    mysql_connect($hostname,$username,$password);
    mysql_select_db($dbname);
    $r=mysql_query("CREATE TABLE shiti (id INT (6) DEFAULT '0' not null AUTO_INCREMENT, topic TEXT not null , a VARCHAR (60) not null , b VARCHAR (60) not null , c VARCHAR (60) not null , d VARCHAR (60) not null , rightkey CHAR (1) not null , INDEX (id)) ");
    if($r) {echo"success!";}
    else echo"failed";
    ?> 
    查詢試題顯示卡:
     <html>
    <head>
    <title>陔瑞厙---&#63470;枙恀湘</title>
    <link rel="stylesheet" type="text/css" href="css.css">
    <style type="text/css">
    <!--
    body {  font-size: 9pt; color: #000000; text-decoration: none}
    -->
    </style></head>
    <body background="a2.gif">
      <?php
      require "config.php3";
      mysql_connect($hostname,$username,$password);
      mysql_select_db($dbname);
      $r=mysql_query("select * from score");
      $num=0;
      echo"<div align='center'><font size=3 color=red>---陔瑞厙&#63470;枙恀湘---倷堍氪---</font><br><hr width=300 color=red><br>";
      echo"<TABLE border=1 bordercolor=green><TR><TD>暮翹瘍</TD><TD>俷靡</TD><TD>email</TD></TR><TR>";
      if(!$r){echo"遜羶衄暮翹ㄐ&#63384;尕綜ㄐ";}
      else  while($arry=mysql_fetch_array($r))
      {$num++;
       echo"<TD>$num.</TD><TD>$arry[name]</TD><td><a href='../email.php3?email=$arry[email]' target='_blank'>$arry[email]</a></TD></tr>";
     }
    echo"</TABLE></div><p><p>";
    echo"<center><hr width='300' color=red>----鰍栠燴馱悝埏----&copy;陔瑞厙----<br><a href='http://web.nyist.net/~simple'><img src='http://web.nyist.net/~simple/images/666.gif' border='0'></a></center>"; 
    ?>
    </body>
    </html>判斷結果顯示:<html><head>
    <style type="text/css">
    <!--
    body {  font-size: 9pt; color: #9900FF; text-decoration: none}
    -->
    </style>
    <link rel="stylesheet" type="text/css" href="css.css">
    </head>
    <body background="a2.gif">
    <?php
    /* Designed by 遼苤赽 and 貌錘 */
      require"config.php3";
      mysql_connect($hostname,$username,$password);
      mysql_select_db($dbname);
        $r=mysql_query("select id from shiti order by id desc limit 1");
      $max=mysql_result($r,0,"id");
      $r=mysql_query("select * from shiti");
      //$fen=$fen+$fen1;
      echo"<center><TABLE width=400 border=1 bordercolor='#CC99FF'> <TR><TD>";
      echo"斕腔賦彆...<p>";
      for ($i=1;$i<4;$i++ )
      {
       $k=mysql_result($r,$tihao[$i]-1,"rightkey");
       //echo "<font size=2>[$i] &nbsp;斕腔恁寁: $test[$i] ,&nbsp;淏&#63489;湘偶: $k </font><br>";
        if ($test[$i]==$k){
        $fen++;
    }
      }
      echo "<font size=2>軞僕酕勤 $fen 耋枙!&nbsp;&nbsp;</font><br>";
      if($fen==3){$nandu0=$nandu+1; 
      if ($nandu<4)
      { if($nandu==1) echo"斕眒冪徹賸菴珨壽ㄛ冞斕珨旰繭孵!<br><center><img src='$nandu.gif'></center>";
        else if($nandu==2) echo"蛅種斕徹賸謗壽賸ㄛ冞斕珨桲靡&#63509;趼賒猁祥猁陛<br><center><img src='$nandu.gif'></center>";
    else if($nandu==3) echo"癆漲ㄛ&#63537;彆婬斑珨壽腔趕ㄛ憩夔統樓扂蠅腔<font color=red>湮喲蔣</font>賸<br>";
      echo"<br><font size=2>鳩炰斕,斕徹菴 $nandu 壽賸,婬諉婬癆ㄐ<form action='test.php3' method='post'><input type='hidden' name='name' value='$name'><input type='hidden' name='email' value='$email'><input type='hidden' name='nandu' value='$nandu0'><input type='submit' name='a' value='狟珨壽' class='buttongreen'></form>";
      }
      else {echo "<br><font size=2>阺ㄛ鳩炰斕ㄛ斕淩岆毞符ㄛ斕淩岆扂腔髒砉陛﹝<br>斕蔚夔劂統樓扂蠅腔湮喲蔣ㄛ&#63537;彆斕倷堍腔趕ㄛ蔚腕善扂蠅腔蔣&#63175;,&#63384;暮蛂斕怀&#63541;腔俷靡睿email,&#63182;森褫眕善陔瑞厙鍰蔣,華硊悝汜馱釬窒.<br>斕腔靡趼: $name,斕腔email:$email.</font>";
       mysql_query("insert score values('$name','$email')");
      }
             }
       else if($fen==0){
         echo"<br><font size=2>斕酕腔珩怮粕賸勘,牊蟹珩夔蟹勤珨耋陛,疑疑悝炾勘!</font>";
             }
      else echo"<br><font size=2>竭疻熄,斕腔傖憎祥燴砑ㄛ祥夔輛&#63541;扂蠅狟珨壽腔恀湘,筍珩祥猁閡陑韃,珨&#63357;褫眕植芛婬懂!<br>傖憎蚥凅腔趕褫衄苤獰昜韃!婬&#63471;贗薯勘!</font>";
      echo"</TD>  </TR>  </TABLE></center>";
      echo"<p><center><font size=2><a href='index.htm'>[扂猁笭陔酕]</a></font></center>";
      echo"<p><center><hr width=400 color=black>----鰍栠燴馱悝埏----&copy;陔瑞厙----<br><a href='http://web.nyist.net/~simple'><img src='http://web.nyist.net/~simple/images/666.gif' border='0'></a></center>";
    ?>
    </html>由于這里的電腦是繁体win,所以上面的字大家可能不認識,呵呵,我也不認識,但不影響程序吧.
    (config.php3省羅了)
      

  6.   

    to :loveme_y(老猫) 
        aomeng(冰雪六月) 
    两位大侠,可否讲得更详细些阿?