1

私の疑問は、私が持っているとどうなるかについてです

これらの div タグは、jquery を使用したトランジション効果を使用して隠されています。結果で div 1 2 3 の結果を取得したい

1 div
  <div id="1">    
   </div>      
2 div
   <div id="2">
    </div>       
3 div
   <div id="3">
   </div>
   <input type="submit" name="first-sudmit" value="NEXT" onclick="result(this.value)" />
    </div>
    <div id="result">   
        result    
    </div>

jsで:

<script type="text/javascript">
function showResult()    
{
    alert("dfadsfdasf");
    xmlhttp.open("GET","result.php?q="+str,true);
    xmlhttp.send();
}
</script>

そしてシリアライゼーションも試しました..... phpスクリプトを実行していません

お気に入り

js:

<script type="text/javascript">     
function showFormData(oForm) {
   var msg = "The data that you entered for the form with 'name' attribute='" + oForm.name + "': \n";

  submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('result.php', $("#submit_drop,#submit_radio,#submit_check,#submit_text,#submit_drag_text,#submit_drag_img").serialize(), function(data) {
                 $('#results').html(data);
            });           
   alert(msg);
}  
</script>

php:

   //page1 process
    if(!ekpty($_POST['first-submit']))
    {
        $first1=$_POST['drop1'];
        $first2=$_POST['drop2'];
        $first3=$_POST['drop3'];
        $first4=$_POST['drop4'];
        $first5=$_POST['drop5'];
      for(i=0;i<=4;i++)
      {         
          $sql="INSERT INTO $score1(correct)VALUES('$first[i]')";        
      }                
    }
    else
    {
          print '<script type="text/javascript">'; 
          print 'alert("page 1 no answer is attempted")'; 
          print '</script>'; 
    }
//output resu;ts
$sql="SELECT count(chkpt) from score1 where chkpt='1'";    
echo $sql;

それでは、最後の結果のdivタグでこれらのフォームの結果を取得する方法.......

これに答えてください........

4

1 に答える 1

0

あなたの質問は少し読みにくいですが、あなたが何を求めているのか理解できれば、シリアル化コードは機能すると思いますが、シリアル化したい要素を含むフォームの ID を使用する必要があると思います。そう:

1 div
  <div id="1">
     <form id="firstFormToSubmit">......</form>
   </div>      
2 div
   <div id="2">
     <form id="secondFormToSubmit">......</form>
    </div>       
3 div
   <div id="3">
    <form id="thirdFormToSubmit">......</form>
   </div>
   <input type="submit" name="first-sudmit" value="NEXT" onclick="result(this.value)" />
    </div>
    <div id="result">   
        result    
    </div>

そして、これらのフォームを処理するには:

submitHandler: function(form) {
            // do other stuff for a valid form
            $.post('result.php', $("#firstFormToSubmit").serialize(), function(data) {
             $('#results').html(data);
        });
于 2012-10-05T13:22:10.523 に答える