lundi 30 mars 2015

why the form is not working on submission

i have created two pages on one there is xml code attached to php and html code which is on the second page. so when i click on link the form appears perfectly in specific section but when i submit i it dissappears giving no results or not showing any validations that ive applied in the form


this is my xml function



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();
}


and this is the form on other page 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>

Aucun commentaire:

Enregistrer un commentaire