I am new to this site and to programming.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Login page</title>
<script> //This is the client side form validation with Javascript
//This code is executed on the client's browser
function validateForm()
{
var x=document.getElementById("username").value;
if (x==null || x=="") //check that the name field is not blank
{
alert("Your username must be filled out");
return false;
}
var y =document.getElementById("password").value;
if (y==null || y=="") //check that the project field is not blank
{
alert("Your password must be filled out");
return false;
}
}
</script>
<?php //This is the server side form validation with PHP
//This code executes on the web server
//Write your server side form validation code here
//checks form is submitted
I am trying to get the data up from the username and password to proccess through this function. I have been messing around with it for hours now and have finally giving up. Any help would be nice.
function checkUserData($inputData) {
$inputData = htmlspecialchars($inputData);
$inputData = trim($inputData);
$username = stripslashes($inputData);
return $inputData;
}
?>
</head>
<body>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>"onsubmit="return validateForm()">
Username: <input type="text" name="uname" id="username" /><br/>
Password: <input type="text" name="pwd" id="password" maxlength="6" /><br/>
<input type="submit" value="Login"/>
<input type="Reset" value="Reset"/>
</form>
</body>
</html>