how to add form values in two tables
Posted: Wed Feb 15, 2012 12:26 am
please clear my doubt.
I have two tables,
table 1
personal_info
1. regno
2. empname
3. address
4. mobileno
table 2
office_info
1. regno
2. dateofjoin
3. experience
4. ctc
5. noticeperiod
These two tables have relations with the field 'regno'
Using single form i want to insert the values into these two table. How to do this.
My coding is....
With Regards,
Jawahar
I have two tables,
table 1
personal_info
1. regno
2. empname
3. address
4. mobileno
table 2
office_info
1. regno
2. dateofjoin
3. experience
4. ctc
5. noticeperiod
These two tables have relations with the field 'regno'
Using single form i want to insert the values into these two table. How to do this.
My coding is....
Code: Select all
<?php
error_reporting(0);
if($_REQUEST['submit'])
{
$regno = $_REQUEST['empregno'];
$empname = $_REQUEST['empname'];
$address = $_REQUEST['address'];
$mobile = $_REQUEST['mobile'];
$doj = $_REQUEST['doj'];
$experience = $_REQUEST['pre_exp'];
$ctc = $_REQUEST['ctc'];
$notice_period = $_REQUEST['notice_period'];
}
?>
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form name="frm" method="post" action="#">
<table>
<tr>
<td>Emp Reg No</td>
<td><input type="text" name="empregno"></td>
</tr>
<tr>
<td>Employee Name</td>
<td><input type="text" name="empname"></td>
</tr>
<tr>
<td>Address</td>
<td><textarea name="address"></textarea></td>
</tr>
<tr>
<td>Mobile No</td>
<td><input type="text" name="mobile"></td>
</tr>
<tr>
<td>Date of Joining</td>
<td><input type="text" name="doj"></td>
</tr>
<tr>
<td>Previous Experience</td>
<td><input type="text" name="pre_exp"></td>
</tr>
<tr>
<td>Current CTC</td>
<td><input type="text" name="ctc"></td>
</tr>
<tr>
<td>Notice period</td>
<td><input type="text" name="notice_period"></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" value="Add Employee"> <input type="submit" name="cancel" value="Cancel"></td>
</tr>
</table>
</form>
</body>
</html>With Regards,
Jawahar