Hi,
I want to retrieve data from my database and display it in a particular form. The data should be displayed in text boxes. This is the coding that i have used. But it is not working. Can someone help me out......
<?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:598px;
z-index:3;
left: 206px;
top: 300px;
}
#form1 {
font-size: 18px;
font-weight: bold;
}
body,td,th {
font-size: 18px;
}
-->
</style>
</head>
<body>
<div id="apDiv4">
<form action="" method="post" name="form1" id="form1">
<fieldset>
<legend class="cap"> Customer Details</legend>
<table width="85%" height="350" border="0" align="center" cellpadding="5" cellspacing="0">
<?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="46%" class="title02" align="left">National ID</td>
<td width="50%" class="attribute1" align="left"><input type="text" name="nic" size="30" class="attribute1" value="<?=$row['nic']?>" / ></td>
<td width="2%"> </td>
</tr>
<tr height="30">
<td height="33"> </td>
<td width="46%" class="title02" align="left">Full Name</td>
<td width="50%" class="attribute1" align="left"><input type="text" name="full_name" size="50" class="attribute1" value="<?=$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="<?=$row['name_with_initials']?>" /></td>
</tr>
<tr height="30">
<td width="2%"> </td>
<td width="46%" class="title02" align="left">Address</td>
<td width="50%" class="attribute1" align="left"><label>
<textarea name="address" value="<?=$row['address']?>" id="textarea" cols="45" rows="5"></textarea>
</label></td>
<td width="2%"> </td>
</tr>
<tr height="30">
<td width="2%"> </td>
<td width="46%" class="title02" align="left">Contact Number</td>
<td width="50%" class="attribute1" align="left"><input type="text" name="contact_number" size="30" class="attribute1" value="<?=$row['contact_number']?>" /></td>
<td width="2%"> </td>
</tr>
<tr height="30">
<td width="2%"> </td>
<td width="46%" class="title02" align="left">Sex</td>
<td width="50%" class="attribute1" align="left"><p>
<select name="gender" value="<?=$row['gender']?>" id="jumpMenu" >
<option selected="selected">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" id="button" value="Approve Account" />
</label>
<label>
<input name="button" type="submit" id="button" value="Modify" />
</label>
<label> <a href="accsup_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>
<img src="../images/mahapitiya 1.jpg" width="1024" height="139" />
</body>
</html>
Thanks,
Heshan.