hi i have managed to put together the following code, but the only problem is when i press the edit button it submits the data to the database but doesnt refesh the screen with new data afterwards it just the data that already existed.
Im sure its an eaxy fix but cant work it.
<head>
<link rel="STYLESHEET" type="TEXT/CSS" href="style.css">
</head>
<?
$hostname = "localhost";
$username = "pirccgs";
$password = "incomes1";
$dbname= "matts";
mysql_connect($hostname, $username, $password);
mysql_select_db($dbname) or die( "cant connect to $dbname");
updatevote(); // You have to call the function
$query = "SELECT count(*) FROM RESOLUTIONS where SubCode = 2";
$result = mysql_query($query);
if(!$result) error_message(sql_error());
$query_data = mysql_fetch_row($result);
$total_num_user = $query_data[0];
echo "<CENTER><H3>$total_num_user resolutions found.</H3></CENTER>\n";
function updatevote()
{
$result = mysql_query("SELECT * FROM RESOLUTIONS where SubCode = 2");
if(($row = mysql_fetch_array($result)) != 0) {
echo"<DIV ALIGN=CENTER>";
echo"<TABLE BORDER=0 WIDTH=390 height=1 CELLPADDING=0>";
echo"<TR>
<Td class=tabletexthead WIDTH=190 height=1>MasterCode</Td>
<Td class=tabletexthead WIDTH=190 height=1>SubCode</Td>
<Td class=tabletexthead WIDTH=110 height=1 align=center>Vote</Td>
</tr>";
$i = 0;
do
{
echo "<form method='post' action='$php_self'>
<TR>
<td class=\"tabletext\" WIDTH=\"190\" height=\"1\">$row[MasterCode]</td>
<TD class=\"tabletext\" WIDTH=\"190\" height=\"1\">$row[SubCode]</TD>
<TD class='tabletext' WIDTH='190' height='1'>
<input type='text' name='VoteField_$i' value='" .$row['vote'] . "'></TD>";
$i++;
}
while($row = mysql_fetch_array($result));
echo "<input type='submit' name='edit' value='edit'></form>";
}
else
{
echo "no records found";
}
}
if(isset($edit)) {
mysql_query("update RESOLUTIONS set vote ='$VoteField_0' where MasterCode = '1'");
}
mysql_close();
?>
</TABLE>
</DIV>