i got a weird problem
Code:
<SCRIPT LANGUAGE="JavaScript">
function processAnn () {
answer = confirm('Confirm ' + form1.textarea.value)
if (answer == 1) {
<?
$query = "UPDATE `announcement` SET `Announcement` = 'hi'";
$result = mysql_query($query) or die("Query error<br/>" . mysql_error());
?>
}
}
</SCRIPT>
Code:
<input name="Save" type="submit" class="style11" id="Save" value="Save announcement" onclick="processAnn()" />
now evertime i refresh the page, it ust writes 'hi' to the database :S
so it keeps on doing this
$query = "UPDATE `announcement` SET `Announcement` = 'hi'";
but it should only do that when i click 'Ok' in the confirm msgbox