Last active
December 23, 2015 16:09
-
-
Save omatt/6660718 to your computer and use it in GitHub Desktop.
Sample PHP code that accepts input and redirecting to another page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<head> | |
<title>Seatwork</title> | |
<script type="text/javascript"> | |
function valForm(){ | |
if(document.myForm.firstName.value==""){ | |
if(document.myForm.firstName.value==""){ | |
document.getElementById("fName").innerHTML = "this is required"; | |
} | |
else{ | |
document.getElementById("fName").innerHTML = ""; | |
} | |
} | |
else{ | |
document.getElementById("fName").innerHTML = ""; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<p>Fill up the following | |
<hr> | |
<form name="myForm" action ="output.html" method="post" onsubmit="return valForm()"/> | |
<p>First name: | |
<input type="text" name="firstName"/> | |
<span id="fName" style="color:red"></span> | |
<p> | |
<input type = "submit" value="Submit" onclick="valForm()"/> | |
</form> | |
</body> | |
</ html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment