Hi all,
This is regarding part of my project. There is a junior staff member who adds data to the database by way of a form.(customer details) Thereafter a supervisor should logged into the system and if he needs he should be able to modify the details entered by junior staff member.
This is the code regarding retrieval and modification of data.
<?php
$connect=mysql_connect("localhost","root","");
mysql_select_db("bank",$connect) or die ("could not select database");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#apDiv4 {
position:absolute;
width:776px;
height:433px;
z-index:3;
left: 182px;
top: 279px;
}
#form1 {
font-size: 18px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<p><img src="../images/mahapitiya 1.jpg" width="1024" height="139" />
</p>
<p> </p>
<p> </p>
[B][B]/*<?php
$nic =$_POST['nic'];
$full_name=$_POST['full_name'];
$name_with_initials=$_POST['name_with_initials'];
$address=$_POST['address'];
$contact_number=$_POST['contact_number'];
$gender=$_POST['gender'];
$result = mysql_query("UPDATE `customer` SET `nic` = '$nic', `full_name` = '$full_name', `name_with_initials` = $name_with_initials', address = '$address', contact_number = '$contact_number', gender = '$gender' WHERE `customer_id` = '$customer_id' ");
if($result)
echo "Your information has been successfully added to the database.";
else
echo "Failed";
?>*/[/B][/B]
<div id="apDiv4">
<form action="" method="post" name="form1" id="form1">
<fieldset>
<legend class="cap"> Customer Details</legend>
<table width="83%" border="0" cellspacing="0" cellpadding="5" align="center">
<?php
$query = "select * from customer";
$result = mysql_query($query) or die(mysql_error());
while ($row=mysql_fetch_array($result)){
?>
<tr>
<td> </td>
<td class="title02"> </td>
<td> </td>
<td> </td>
</tr>
<tr height="30">
<td width="2%" height="35"> </td>
<td width="43%" class="title02" align="left">National ID</td>
<td width="53%" class="attribute1" align="left"><input type="text" name="nic" size="30" class="attribute1" value=<?php echo $row['nic'];?>></td>
<td width="2%"> </td>
</tr>
<tr height="30">
<td height="33"> </td>
<td width="43%" class="title02" align="left">Full Name</td>
<td width="53%" class="attribute1" align="left"><input type="text" name="full_name" size="50" class="attribute1" value=<?php echo $row['full_name']?>></td>
<td width="2%"> </td>
</tr>
<tr height="30">
<td height="34"> </td>
<td class="title02" align="left">Name With Initials</td>
<td class="attribute1" align="left"><input type="text" name="name_with_initials" size="30" class="attribute1" value=<?php echo $row['name_with_initials']?>></td>
</tr>
<tr height="30">
<td width="2%"> </td>
<td width="43%" class="title02" align="left">Address</td>
<td width="53%" class="attribute1" align="left"><label>
<textarea name="address" id="textarea" cols="45" rows="5"><?php echo $row['address']; ?></textarea>
</label></td>
<td width="2%"> </td>
</tr>
<tr height="30">
<td width="2%"> </td>
<td width="43%" class="title02" align="left">Contact Number</td>
<td width="53%" class="attribute1" align="left"><input type="text" name="contact_number" size="30" class="attribute1" value=<?php echo $row['contact_number']?>></td>
<td width="2%"> </td>
</tr>
<tr height="30">
<td width="2%"> </td>
<td width="43%" class="title02" align="left">Sex</td>
<td width="53%" class="attribute1" align="left"><p>
<select name="gender" id="jumpMenu" >
<option selected="selected"><?php echo $row['gender']; ?></option>
<option>Male</option>
<option>Female</option>
</select>
<br />
</p></td>
<td width="2%"> </td>
</tr>
</table>
<p align="center"> </p>
<p align="center">
<label>
<input name="button" type="submit" onclick="return Validate();" id="button" value="Modify Details" />
</label>
<label> <a href="accofficer_help.php">
<input name="button" type="submit" id="button" value="Help" />
</a></label>
</td>
</p>
</fieldset>
<td width="5%"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="center"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><font color="red" size="1" ></font></td>
<td> </td>
</tr>
<?php
}
?>
</table>
</form>
</div>
<p> </p>
</body>
</html>
The code marked inside /* and */ is the modification code which is not working.Anyone one can give me the correct coding?
Thanks,
Heshan.