Registration Form Using PHP And MySQL
Registration Form Using PHP And MySQL :
EmpInsert.html
<html>
<body bgcolor="pink">
<h1
align="center">Indian Tech : Registration Form</h1>
<hr color="cyan"
size="8" align="center" width="65%">
<form action="DBtest.php"
method="get">
<table style="font-family:
verdana; font-size: 14px;background-color: #CCCCFF"
width="50%">
<tr
height="40">
<td>EmpNo</td>
<td><input
type="text" name="t1" size="30"></td>
</tr>
<tr
height="40">
<td>EName</td>
<td><input
type="text" name="t2" size="30"></td>
</tr>
<tr
height="40">
<td>Salary</td>
<td><input
type="text" name="t3" size="30"></td>
</tr>
<tr
height="40">
<td
colspan="2" align="center">
<input
type="submit" value="Save Emp"></td>
</tr>
</table>
</form>
</body>
</html>
DBTest.php
<?php
$con =
mysql_connect("localhost", "root", "");
mysql_select_db("emp");
$res=
mysql_query("insert into emp1
values($_GET[t1],'$_GET[t2]',$_GET[t3])");
if($res)
header('location: success.html');
else
header('location:failure.html');
mysql_close($con);
?>
Success.html
<html>
<head>
</head>
<body bgcolor="green"
text="white">
<h1>employee registration is
successful</h1>
<br><br>
<a href="empinsert.html"
>Click here to register more employees</a>
</body>
</html>
OutPut:
employee registration is successful
Failure.html
<html>
<head>
</head>
<body
bgcolor="red" text="white">
<h1>employee registration is not successful</h1>
<br><br>
<a
href="empinsert.html" >Click here try to register more employees</a>
</body>
</html>
OutPut:
Great coding. I am try it. Useful.
ReplyDeleteThanks for Posting.
http://www.dreamdestinations.in/
This comment has been removed by the author.
ReplyDelete