PHP Registration Form Part-3

This post is the continuation of the php registration form part-2.In first two parts of registration page i just explained about

How to design a registration page?

How to create a table in database?

How to insert the values into the database?

Now i’m going to explain about validation. validation is very most important thing in each and every project that indicates the quality of the product or project. Here in the Registration form we can validate the values by means of javascript or php.

Javascript validation is mostly prescribed so as i do… okay now i’m going to the first Part of the  php registration form in the blog so we are going to that register.html.

In that Html page between the head tags type the following script

<script language=”JavaScript” type=”text/javascript”>
function checkform (form1)
// ** START **
var fname = form1.fname.value;
var email =;
var pass = form1.password.value;
var lname = form1.lname.value;
var cont = form1.contactno.value;
if (email == “”) {
alert(“Please Enter Your Email.”);
return false;
if (pass == “”){
alert(“Please Enter Your Password.”);
return false;
if (fname == “”){
alert(“Please Enter Your First Name”);
return false;
if (lname == “”){
alert(“Please Enter Your Last Name”);
return false;
if (cont == “”){
alert(“Please Enter Your contact No”);
return false;

return true;

// ** END **


Now i’m going to explain the script .First i’m using a function called checkform(formname)

where form1 is my form name you can get that from my register.html In script you can get the values by using form name so first i declaring variables by getting the values by using formname.

Suppose if your not using the variable means you have to get values by[ formname.fieldname.value] instead of variables used above.

Here i’m checking that some values Must be entered in the textbox if  its not  it will show some alert message. so i’m checking


alert(“some error text”);

return false;

}   is  the syntax to validate empty values

so now the final thing is to do was onsubmit event in the form tag where we call the above function checkform(form1)

<form name=”form1″ method=”post” action=”update.php” onsubmit=”return checkform(form1);”>

you can find the bold letters in the above form tag. return is used to return the values from that function

Thats it for now

In next Part

I will explain about how to display the stored information from the database and to perform the edit and delete operation in it.

Its similar to the admin panel section but without login panel

Will see you in the next part of the PHP registration form.


Working For Cause Not For Applause

Tagged with: , , , ,
Posted in PHP, web

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: