Button's Code In PHP:
<?php
if(isset($_POST['btnReg']))
{
$NM = $_POST['txtName'];
$EM = $_POST['txtEmail'];
$PD = $_POST['txtPwd'];
$PH = $_POST['txtPhno'];
$AD = $_POST['txtAdd'];
$OC = $_POST['txtOcc'];
$A = mysql_connect("LocalHost","root","") or die("Error in MYSQL Connection");
mysql_select_db("asd",$A) or die("Error in Data Base");
mysql_query("Insert into tbluser values ('','$NM','$EM','$PD','$PH','$AD','$OC')", $A) or die("Error in Insert Query");
mysql_close($A);
echo '<script language="javascript">';
echo 'alert("Registered Successfuly...!")';
echo '</script>';
}
?>
Form's Code in HTML:
<div id="templatemo_content_right">
<h1 align="center">Registration Form</h1>
<form action="Reg.php" method="post">
<table border=1 CellPadding=5 CellSpacing=5 align="center">
<tr>
<td>Name</td>
<td><input type="text" name="txtName" Required="required" placeholder="Enter Name" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="email" name="txtEmail" Required="required" PlaceHolder="Enter Email" /></td>
</tr>
<tr>
<td>Passward</td>
<td><input type="password" name="txtPwd" Required="required" placeholder="Enter Passward" /></td>
</tr>
<tr>
<td>Phone.No</td>
<td><input type="text" name="txtPhno" Required="required" placeholder="Enter Phone.No" /></td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="txtAdd" Required="required" placeholder="Enter Address" /></td>
</tr>
<tr>
<td>Occupation</td>
<td><input type="text" name="txtOcc" Required="required" placeholder="Enter Occupation" /></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="btnReg" value="Register Me"></td>
</tr>
<!--<button id="btnreg" onclick="reg()">Register Me...!</button>-->
</table>
</form>
</div>
No comments:
Post a Comment