Monday 10 September 2012

Simple Registration Page with Database Connectivity in HTML and PHP: Part 1


<!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" />
<title>LBSIM-Conference Management System</title>

<link href="css/Navbar.css" rel="stylesheet" type="text/css" />
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="Image/Background.jpg">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<script>
function validate(){
    if(document.form.fullName.value == ""){
        alert( "Name cannot be empty" );
        document.form.fullName.focus();
        return false;
    }
    if(document.form.age.value == ""){
        alert( "Age cannot be empty" );
        document.form.age.focus();
        return false;
    }
    if(document.form.email.value == ""){
        alert( "Email cannot be empty" );
        document.form.email.focus();
        return false;
    }
 if(document.form.password.value == ""){
        alert( "Password cannot be empty" );
        document.form.password.focus();
        return false;
    }
    if(document.form.username.value == ""){
        alert( "username cannot be empty" );
        document.form.username.focus();
        return false;
    }
    if(document.form.cnfpwd.value == ""){
        alert( "Confirm Password cannot be empty" );
        document.form.cnfpwd.focus();
        return false;
    }
 if(document.form.cnfpwd.value ==document.form.password.value ){
        alert( "Passwords match" );
        document.form.cnfpwd.focus();
        return true;
    }
 if(document.form.password.value.length<8 ){
        alert( "Password should be have atleast 8 character" );
        document.form.password.focus();
        return false;
    }
 if(document.form.cnfpwd.value !==document.form.pwd.value ){
        alert( "Passwords match" );
        document.form.cnfpwd.focus();
        return false;
    }
    if(document.form.phone.value == ""){
        alert( "Phone Number cannot be empty" );
        document.form.phone.focus();
        return false;
    }
 if(document.form.qualification.value == ""){
        alert( "Qualification cannot be empty" );
        document.form.qualification.focus();
        return false;
    }
 if(document.form.gender.value == 0){
        alert( "Please select a gender" );
        document.form.gender.focus();
        return false;
    }
 if(document.form.address.value == 0){
        alert( "Address field can not be left empty" );
        document.form.address.focus();
        return false;
    }
 if(document.form.Institute.value == 0){
        alert( "Institute field can not be left empty" );
        document.form.Institute.focus();
        return false;
    }
 if(document.form.expertise.value == 0){
        alert( "Area of Expertise field can not be left empty" );
        document.form.expertise.focus();
        return false;
    }
 if(document.form.workExperience.value == 0){
        alert( "Please enter your work experience" );
        document.form.workExperience.focus();
        return false;
    }
 
 alert("Registration Successfull !");
 window.open("Login.html");
    return true;   
    }  
</script>
<tr>
<td>
<img src="Image/bannersketch.png" width="90%" height="90" />
</td>
</tr>
<tr>
<td>
<div id="navbar" style="margin-top:10px;margin-bottom:20px">
<ul>
<li><a href ="CMS.html" title="View home Page">Home</a></li>
<li><a href ="Login.html" title="Go to Login page">Login</a></li>

<li><a href="PDF/Document1.pdf" title="Reseach Paper Submission Guidelines to Authors">Guidelines</a></li>
<li><a href ="Help.html" onmouseover="Show()" onmouseout="Hide()">Help</a></li>
<li><a href ="Contact.html" title="Contact technical support">Contact</a></li>
<li><a href ="FAQ.html" title="View Frequently asked questions">FAQ</a></li>
</ul>
</div>
</td>
</tr>
<div>
<tr>
<td>
<form name="form" method="post" align = "center" onsubmit="return validate();" action="reg.php">

<font color="blue"><b>
Name:<input type="text" name="fullName" maxlength="16"></br>
Age:<input type="text" name="age" maxlength="2"></br>
Date Of Birth:<input type="text" name="DOB" maxlenght="10"></br>
<label>Gender:</label>
<input type="radio" name="gender" value="male" /> Male
<input type="radio" name="gender" value="female" /> Female</br>
<label>Marital Status:</label><input type="radio" name="maritalStatus" value="single" />Single
<input type="radio" name="maritalStatus" value="married" /> Married</br>
<label>Qualification:</label></br>
<textarea name="qualification" rows="5" cols="20" maxlength="50"></textarea> </br>
Address:<input type="textarea" name="address" maxlength="50"></br>
Email:<input type="text" name="email" maxlength="30"></br>
Phone Number:<input type="text" name="phone" maxlength="10"></br>
Institute:<input type="text" name="Institute" maxlength="50"></br>
Area of Expertise:<input type="text" name="expertise" maxlength="30"></br>
Work Experience:<input type ="text" name="workExperience" maxlength="2"></br>
<hr/></font>
<font color="red"><i>
<p> Please Create a user account with us that would be used for next time Login</p>
Username:<input type="text" id="username" name="username" maxlength="20" minlength="10">
<br/>
Password:<input type="password" id="pwd" name="password" maxlength="20" minlength="8"></br>
Confirm Password:<input type="password" name="cnfpwd" id="cnfpwd" maxlength="20" minlength="8">
</b></i></font></br>
<input type="submit" value="register" name="register" align="middle">
</table>
</form>
</td>
</tr>
</div>
<tr>
<td>

</div>
</div>
</td>
</tr>
<tr align="center" height="100">
<td>
<div id="copyright" style="background-color:#999999;width:100%">
<div style="border=1px solid gray; margin-top:10px">
<ul>
<b>Copyright </b>
</ul>
</div>
</div>
</td>
</tr>
</body>
</html>

No comments:

Post a Comment