Location: PHPKode > scripts > NoticeBoardPro > NoticeBoardPro/update_profile1.php
<?php


// This page enables a user to update their details. Various checks are
// performed to try to ensure that the user enters sensible data. The form
// data are passed to update_profile2.php.


	require "functions.php";
	$profile = userAccess();

?>
<html>

<head>
<title>Update Profile</title>
<link rel="stylesheet" type="text/css" href="style/style.css">
<script language="JavaScript">
function IsNotNull(){
	if (document.form1.email == null ||
		document.form1.name == null ||
		document.form1.password == null ||
		document.form1.password2 == null) {
		alert("Please fill out all the fields.");
		return false;
	}
		if (document.form1.email.value.length == 0 ||
			document.form1.name.value.length == 0 ||
			document.form1.password.value.length == 0 ||
			document.form1.password2.value.length == 0) {
			alert("Please fill out all the fields.");
			return false;
		}
		return true;
}

function IsValidEmail(){
	var email = document.form1.email.value;
	var myreg
		= /^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/
	if (myreg.test(email)) {
		return true;
	}
	else {
		alert("The email address is invalid.");
		return false;
	}
}

function CheckForMatch() {
	if (document.form1.password.value !=
		document.form1.password2.value) {
		alert("The passwords do not match.\n"+
			"Please re-enter them. Thanks");
		return false;
	}
	return true;
}

function checkfields() {
	if (IsNotNull() == false) {
		return false;
	}
	if (IsValidEmail() == false) {
		return false;
	}
	if (CheckForMatch() == false) {
		return false;
	}
	return true;
}
</script>
</head>

<body>

<form name="form1" action="update_profile2.php" method="post" onSubmit='return checkfields();'>

<input type="hidden" name="userID" value="<? echo "$profile->userID" ?>">
<p>Email: <input type="text" name="email" value="<? echo "$profile->email"?>"</p>
<p>Name: <input type="text" name="name" value="<? echo "$profile->name"?>"</p>
<p>Telephone: <input type="text" name="telephone" value="<? echo "$profile->telephone"?>"</p>
<p>Choose a password: <input type="password" name="password" value="<? echo "$profile->password"?>"</p>
<p>Retype password: <input type="password" name="password2" value="<? echo "$profile->password"?>"</p>

<br><br>

<input type="submit" value="Update Details"> <input type="reset">
</form>

</body>
</html>
Return current item: NoticeBoardPro