本帖最后由 SDQDboy 于 2009-09-07 08:27:53 编辑

解决方案 »

  1.   

    1.加history.back(-1);
    function checkform(){
    var theform = document.form1;
    var icount = theform.hiddenField.value;
    var checkOK = false;  for(i=1; i<=icount; i++){
        var theitem = eval("theform.h_QuestionType" + i.toString());    if (theitem.value==3){
          //alert("问答题");    
          var thetextfield = eval("theform.textfield" + i.toString());
          if(thetextfield.value==""){
            alert("第" + i.toString() + "题,您还没有做选择!");
           history.back(-1);//就加这里了
            return false;
          } else{ checkOK = true;}
        }
      }
    if(checkOK){theform.action = "QList.php?id=1";}
    }2.php取数组控件的值,最好把name形式改一下for ($i=0; $i<$array_count; $ii++){ echo "<input type='radio' name='radiobutton[".$i."]' value='".$Q_array[$ii]."'>".$Q_array[$ii]; }下面是php获取值print_r($_POST['radiobutton']);//打印出来是个数组
    $arr=array_values($_POST['radiobutton']);
    for($j=0;$j<count($arr);$j++){
     echo $arr[$j]."<br>";
    }
      

  2.   

    表单提交不对
    <form onsubmit="return checkform();">
    <input type=submit>
    </form>
    checkform里,正确则return true,否则return false;
    这样就能保证没填写完就不提交。