This is file use for edit data in database . the file name (edit.php)
<head>
<meta>
<title>edit</title>
</head>
<body>
<?php
include(“db.php”);
$id=$_REQUEST[‘id’];
echo $id;
$query=”select * from record where id=$id”;
$row=mysql_query($query);
while($run=mysql_fetch_array($row))
{
?>
<h1 align=”center”>Employee Record</h1>
<form method=”post”>
<table border=”1″ align=”center” bgcolor=”#006699″>
<tr>
<td>firstname</td>
<td> <input type=”text” name=”firstname” value=”<?php echo $run[‘firstname’];?>”/> </td>
</tr>
<tr>
<td>lastname</td>
<td> <input type=”text” name=”lastname” value=”<?php echo $run[‘lastname’];?>”/> </td>
</tr>
<tr>
<td>fathername</td>
<td> <input type=”text” name=”fathername” value=”<?php echo $run[‘fathername’];?>”/> </td>
</tr>
<tr>
<td>dob</td>
<td> <select name=”dob”/>
<option>day</option>
<?php
for($day=1;$day<=31;$day++)
{
echo “<option>” .$day. “</option>”;
}
?>
</select>
<select>
<option>month</option>
<?php
$month=array(‘jan’,’feb’,’mar’,’april’,’may’,’june’,’july’,’aug’,’sep’,’oct’,’nov’,’dec’);
foreach($month as $a)
{
echo “<option>” .$a.”</option>”;
}
?>
</select>
<select>
<option>year</option>
<?php
for($year=1985;$year<=2013;$year++)
{
echo “<option>” .$year . “</option>”;
}
?>
</select>
</td>
</tr>
<tr>
<td>contactno</td>
<td> <input type=”text” name=”contactno” value=”<?php echo $run[‘contactno’];?>”/></td>
</tr>
<tr>
<td>address</td>
<td> <input type=”text” name=”address” value=”<?php echo $run[‘address’];?>”/></td>
</tr>
<tr>
<td>agreementsiqn</td>
<td> <input type=”text” name=”agreementsign” value=”<?php echo $run[‘agreementsiqn’];?>”/></td>
</tr>
<tr>
<td>email</td>
<td> <input type=”text” name=”email” value=”<?php echo $run[’email’];?>”/></td>
</tr>
<tr>
<td>password</td>
<td> <input type=”password” name=”password” value=”<?php echo $run[‘password’];?>”/></td>
</tr>
<tr>
<td>gender</td>
<td> <input type=”radio” name=”gender” value=”m” />male
<input type=”radio” name=”gender” value=”f” />female</td>
</tr>
<tr>
<td colspan=”2″ align=”center”> <input type=”submit” name=”submit” value=”submit” /></td>
</tr>
</table>
</form>
<?php
if(isset($_POST[‘submit’]))
{
include(‘db.php’);
$firstname=$_POST[‘firstname’];
$lastname=$_POST[‘lastname’];
$fathername=$_POST[‘fathername’];
$dob=$_POST[‘dob’];
$contactno=$_POST[‘contactno’];
$address=$_POST[‘address’];
$agreementsign=$_POST[‘agreementsign’];
$email=$_POST[’email’];
$password=$_POST[‘password’];
$gender=$_POST[‘gender’];
$update=”update record set firstname=’$firstname’,lastname=’$lastname’,fathername=’$fathername’,dob=’$dob’,contactno=’$contactno’,address=’$address’,agreementsign=’$agreementsign’,email=’$email’,password=’$password’,gender=’$gender’ where id=$id”;
if(!mysql_query($update))
{
echo “data not created”.mysql_error();
}
else header(‘location:usingquery.php’);
}
?>
<?php }
?>
</body>
</html>