write a program for registration form by using form validations?
Validation Should be perform in
the client side
1. Name
should be minimum 5 characters.
2. Age
should be a number
3. Address
should not be empty.
<html>
<head>
<style type=”text/css”>
#address
{
Font-size :13px;
Color : cyan;
}
</style>
<script type=”text/javascript”>
Function checkdata()
{
Var name = document.frm1.t1.value;
Var age = document.frm1.t2.value;
Var address = document.frm1.t3.value;
Document.getElementById(“address”).innerHTML
= “ “;
If(name.length<5)
{
Alert(“name should be min 5
characters!!”);
Document.frm1.t1.focus();
Return false;
}
If(age.length<=0||is
Nan(age))
{
Alert(“age should be a number!!”);
Document.frm1.t2.value=” “;
Document.frm1.t2.focus();
}
If(address.length<=0)
{
Document.getElementById(“address”).innerHTML
= “address should be entered!!”;
Document.frm1.t3.focus();
Return false;
}
}
</script>
</head>
<body
bgcolor=”marron” text=”white”>
<h1 align =
“center”>Indian Technologies</h1>
<hr
color=”yellow” size=”5” width=”52%”
align=”center”><br><br><br>
<form
action=’regform.php’ method=”get” name=”frm1” onsubmit=”return” checkdata()>
<table width=”55%”
style=”background-color:black; color:white; fon-family:verdana; font-size
:20px”>
<tr height=”50”>
<td> name</td>
<td><input name=”text” name=”t1”
size=”25” ></td>
</tr>
<tr
height=”50”>
<td> AGE</td>
<td><input name=”text” name=”t2”
size=”25” ></td>
</tr>
<tr
height=”50”>
<td> Address</td>
<td><textArea name=”t3” rows=”4” columns=”20”
></textArea></td>
<td>
<span id=”address”></span></td>
</tr>
<tr
height=”50”>
<td colspan=”3” align=”center”>
<input type=”submit” value=”register”>
</td>
</tr>
</table>
</form>
</body>
</html>
$_GET : is a builtin global aaray of PHP.
$_POST : stores all the submitted by the client using
GET/POST method .
$_request : is a builtin global
array of PHP that stores all the data submited by the client using GET and POST
methods and also it stores the cookies submitted by client.
Thank you for this information. Find Java Course in Pune. For more information visit Class boat
ReplyDeleteThank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging
ReplyDeleteAsp.Net Training In Chennai | Dot Net Training Center In Chennai | Dot Net Coaching Centers In Chennai
Best Software Testing Training Institute In Chennai | Software Testing Institutes In Chennai | Manual Testing Training In Chennai
Java Training Institute in Chennai | Core Java Training in Chennai | Java Course and Certification
PHP Course in Chennai | PHP Training Institute in Chennai | PHP Course and Certification