为什么表单不能提交

时间:2015-03-30 15:26:39

标签: javascript php forms

我创建了两个页面,其中有一个xml代码附加到php和html代码,它位于第二页。因此,当我点击链接时,表单在特定部分显示完美,但是当我提交i时,它会消失,不会显示任何结果或者没有显示已在表单中应用的任何验证

这是我的xml函数

function showdescriptions(str){
var xmlhttp= new XMLHttpRequest();
xmlhttp.onreadystatechange= function(){
    if(xmlhttp.readyState==4 && xmlhttp.status==200){
        document.getElementById("showajax").innerHTML = xmlhttp.responseText;

    }
}
xmlhttp.open("GET", "loginstudents.php?q="+str ,true);
xmlhttp.send();
}

这是其他页面上的表格i-e loginstudents.php

$q=$_GET["q"];
$id = "";   
$idErr = "";    
if(isset($_POST["submit"])){

        if(empty($_POST["id"])){
            $idErr="ID is required";
        } else {            
         $id=($_POST["id"]);
         if(! $connection){
            die("could not connect:" . mysql_error());
         }

    $sql="SELECT * from student where id='".$id."'" ;
        $totalsql = mysql_query( $sql, $connection );
        if(! $totalsql ){           
            die('Could not get data: ' . mysql_error());
        }   
        $row = mysql_fetch_array($totalsql, MYSQL_ASSOC);
        if($id===$row['id'] ){
            $_SESSION["id"]=$row['id'];

        }
     }
}

  <form id="arrayform" method="post">
  <table class="table2">
  <tr><td><strong>Enter Your ID</strong></td></tr>
  <tr>
  <td><strong>ID:</strong></td>
  <td><input type="number" name="id" /></td>
  <td><span class="error"><?php echo $idErr; ?></span></td>
   </tr>
   <input type="hidden" name="submitstatus" id="submitstatus" />
   <tr><td><a href="forgotpwid.php">Forgot ID?</a></td>
   <td><input type="submit" name="submit" value="Submit" /></td>
   </tr>
   </table>
   </form>

0 个答案:

没有答案