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>now evertime i refresh the page, it ust writes 'hi' to the database :SCode:<input name="Save" type="submit" class="style11" id="Save" value="Save announcement" onclick="processAnn()" />
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




Reply With Quote