PHP code:
function update_summary()
{
// Needs to be clled when Update button is pressed and not just called when the page loads!!
$summary = $_GET["summary_text"];
$result = mysql_query("UPDATE kpi_summary SET summary_text='$summary' WHERE subsystem_name='total_topups'")
or die(mysql_error());
}
HTML Form:
<table width="700" align="center" cols="1">
<form name="total_topups_summary" method="get" onsubmit="<?php update_summary() ?>">
<tr>
<td>Please enter new summary:</td>
</tr>
<tr>
<td><textarea rows="4" name="summary_text"><?php print $tot_topups[5]; ?></textarea></td>
</tr>
<tr>
<td width="500"><input type="submit" value="Update Summary"></td>
</tr>
</table>