View Single Post
Old 01-09-2013, 05:27 PM   PM User | #1
Demeteor
New to the CF scene

 
Join Date: Jan 2013
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Demeteor is an unknown quantity at this point
Does Not send form

Hello there. I want to send a form to the next one but it seems my javascript is interupting or something. can samome help me a bit here ??

here is my code the problem is , it does not redirect to the next page step2.php

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <LINK href="mycss.css" rel="stylesheet" type="text/css">

<title>Home Page </title>
<?php
session_start();
?> 
<script>
	function formSubmit()
	{
	//Clears All the error messages. so they can be reprinted 
	//or show that evrything is correct
	 	var node = document.getElementById("wrongpass")
		node.innerHTML =""
	 	var node = document.getElementById("noname")
		node.innerHTML =""
    	var node = document.getElementById("nolastname")
		node.innerHTML =""
	//Xpass is a valitation variable where it INC when it sees a correct field
	//if its 3 it will accept the form and send the client to next page with 
	//The Login Information
		var xpass = 0 ; 
		
//The Following if satements wil check if the user added correct info in the form		
 	if  ( document.getElementById("pass").value == 5 )  
 		{
  			xpass = xpass +1 ; 
 		}
 	else
  		{ 
			document.getElementById("wrongpass").innerHTML = "Correct Password";
		 	document.getElementById("wrongpass").innerHTML = "You Have Entered A wrong <b>Password</b> (Its 5)";

		}

 	if  ( document.getElementById("lastname").value == "" )
	 	{
    	document.getElementById("nolastname").innerHTML = "You Did Not Enter A <b>Last Name</b>";
 		}
    else 
 		{
  			xpass = xpass +1 ;
 		}
 
    if  ( document.getElementById("firstname").value == "" ) 
		{
  		 document.getElementById("noname").innerHTML = "You Did Not Enter A Name";
   
 		}
   else 
 		{
  			xpass = xpass +1 ;
 		}
 
		if ( xpass == 3) {

		}

	else { 
    alert("Check The Info Given to you to know whats wrong"); 
	}

}


</script>

</head>

<body>
	<div id="page-wrap">
		<h1>Welcome Please Login </h1>
		<p id="wrongpass"></p> 
		<p id="noname"></p> 
		<p id="nolastname"></p> 

	<div id="contact-area">
	<form  action="step2.php" method="get" id="login" > 
		First name: <input type="text" class="contactform" name="fname" id="firstname"><br> 
		Last name: <input type="text" name="lname" id="lastname"><br>
		Password :  <input type="password" name="pass" id = "pass"  > <br><br>
		<input type="button" onclick="formSubmit()" value="Submit"> 
	</form>
	</div>
	</div> 

</body>
</html>
Demeteor is offline   Reply With Quote