Tried to get this for about three days actually suck at coding and i need to
do some validation for a database as one of the task's.
Breif: The php will need some validation of data entry and an INSERT query. The checking of the connection is not enough.
Programming Code for index:
PHP Code:
<!DOCTYPE html>
<html>
<head>
<title> Database Validation</title>
<script>
function check(Form1) {
var Firstname = Form1.Firstname.value;
var Lastname = Form1.Lastname.value;
var dob = Form1.dob.value;
var postcode = Form1.postcode.value;
if(Firstname.length == 0) {
alert("Enter a valid firstname and try again");
}
if(Lastname.length == 0) {
alert("Enter a valid lastname and try again");
}
if(dob.length == 4) {
alert("Date of birth error go back and try again");
}
if(postcode.length == 0) {
alert("Please enter a valid postcode and try again. ");
}
else {
alert("Sorry but you have not entered the correct information to check against the database.")
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
}
-->
</style></head>
<body>
<form id="form" action="check.php" method="POST" onSubmit="return check(this)">
<div align="center"><br>
Form Validation <br>
</div>
<label>First Name: <input type="text" id="Firstname"></label>
<br>
<label>Forename :
<input type="text" id="Lastname"></label>
<br>
<label>Date Of Birth: <input type="date" id="dob"></label>
<br>
<label>Post Code: <input type="text" id="postcode"></label>
<input type="submit" value="Submit" id="submit" >
<br><br>
<br>
</form>
</body>
</html>
i basically need the check.php making so that it checks the validation of the data entered into this form on index.php and if it does not match what is found in the database it returns an error.
Copy of the database is located here:
http://dl.dropbox.com/u/27402420/Col...risLeisure.sql
if somebody can do this for me you will be helping me out pretty hast im currently in college and this is all i need for this unit to pass it.