Thanks for your reply, devinemke. Yes, my database has got a primary key field called id. My form processing code is below. Apart from that, I don't quite understand what you mean. Could you show me how to do it? Thanks.
<?php
$query2=("SELECT * FROM table");
$result2=mysql_query($query2);
?>
<table width=700 border=1 height="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0"><tr bgcolor ="cyan">
<td width="375" align="center" bgcolor="#CCFFFF"><b><font face="arial" size="2.5">Raw Data</a></font></strong></td>
<td width="60" align="center" bgcolor="#CCFFFF"><b><font face="arial" size="2.5">Size</font></strong></td>
<td width="60" align="center" bgcolor="#CCFFFF"><b><font face="arial" size="2.5">Price</font></strong></td>
<td width="80" align="center" bgcolor="#CCFFFF"><b><font face="arial" size="2.5">Untick Bad Data</font></strong></td>
</tr>
<?php
//the code below is to display the results in multi colours
$color="1";
while($rows=@mysql_fetch_array($result2)){
if($color==1){
echo "<tr bgcolor='#CCFFFF'>
<td align=left><font face=arial size=1.5>{$rows['full_add']}</td></font>
<td align=center><font face=arial size=1.5>{$rows['size']}</td></font>
<td align=center><font face=arial size=1.5>{$rows['price']}</td></font>
<td align=center><input type='checkbox' name='C1' value='ON' checked></td>
</tr>"; //check boxes are created above.
// Set $color==2, for switching to other color
$color="2";
}
// When $color not equal 1, use this table row color
else {
echo "<tr bgcolor='#FFFFFF'>
<td align=left><font face=arial size=1.5>{$rows['full_add']}</td></font>
<td align=center><font face=arial size=1.5>{$rows['size']}</td></font>
<td align=center><font face=arial size=1.5>{$rows['price']}</td></font>
<td align=center><input type='checkbox' name='C1' value='ON' checked></td>
</tr>"; //check boxes are created above.
// Set $color back to 1
$color="1";
}
}
echo '</table>';
?>
<table width="700" border="0">
<?php
switch($_POST['category'])
{
case 'condo':
echo "<form name='form5' method='POST' action=''>";
echo "<tr bgcolor='#CCFFFF'><td align=right>";
echo "<input name='submit_condo' type='submit' id='submit_condo' value='Re-calculate Condo'>";
echo "</td></tr></form>";
break;
case 'house':
echo "<form name='form5' method='POST' action=''>";
echo "<tr bgcolor='#CCFFFF'><td align=right>";
echo "<input name='submit_house' type='submit' id='submit_house' value='Re-calculate Houses'>";
echo "</td></tr></form>";
break;
case 'factory':
echo "<form name='form5' method='POST' action=''>";
echo "<tr bgcolor='#CCFFFF'><td align=right>";
echo "<input name='submit_factory' type='submit' id='submit_factory' value='Re-calculate Factory'>";
echo "</td></tr></form>";
break;
case 'land':
echo "<form name='form5' method='POST' action=''>";
echo "<tr bgcolor='#CCFFFF'><td align=right>";
echo "<input name='submit_land' type='submit' id='submit_land' value='Re-calculate Land'>";
echo "</td></tr></form>";
break;
case 'office':
echo "<form name='form5' method='POST' action=''>";
echo "<tr bgcolor='#CCFFFF'><td align=right>";
echo "<input name='submit_office' type='submit' id='submit_office' value='Re-calculate Office'>";
echo "</td></tr></form>";
break;
case 'shop':
echo "<form name='form5' method='POST' action=''>";
echo "<tr bgcolor='#CCFFFF'><td align=right>";
echo "<input name='submit_shop' type='submit' id='submit_shop' value='Re-calculate Shop'>";
echo "</td></tr></form>";
}
?>
</table>
<?php
$submit_house = $_POST['submit_house'];
$C1 = $_POST['C1']; /*this is supposed to be the variable to declare the check boxes though I don't think this is the right way to do it.*/
if(isset($submit_house))
{
$username="something";
$password="something_else";
$database="house_values";
$host="localhost";
mysql_connect ("$host","$username","$password");
mysql_select_db($database) or die( "Where's the database man?");
$query5=("SELECT * FROM temp");
}
$result5=mysql_query($query5);
?>
//the rest of the code to display the results is beyond this line.