Does anyone know how I can automatically refresh the page after the script is executed ( after user hits submit) and the database is updated, so that the line "The main office is now..." shows the new entry into the db? Thanks.
$query = "SELECT * FROM officehours WHERE id=1";
$result = mysql_query($query) or die("Query failed1");
$row = mysql_fetch_array($result);
print "<br><br><p align='center'><font face='Verdana' size='2'>The main office is now <b>$row[1]</b></font></p>";
print "<form name='change' method='post' action='admin.php'>";
print "<table width='250' border='0' cellpadding='3' cellspacing='0' align='center'>\n";
print "<tr bgcolor='#ffffff'><td width='250'><font face='Verdana' size='1' color='#FFFFFF'>ID</font><input type=hidden name=" . $id . " value='0' size='20'></td></tr>";
print "<tr bgcolor='#000066'><td width='250'><font face='Verdana' size='2' color='#FFFFFF'><b>Change office status:</b> </font><SELECT NAME='poffice'>";
print "<OPTION value='Open'>Open</option>\n";
print "<OPTION value='Closed'>Closed</option>\n";
print "</SELECT></td></tr><tr><td width='250'><br><p align='center'>";
print "<input type='hidden' name='pid' value=" . $pid . ">";
print "<input type='hidden' name='action' value='edit'>";
print "<input type='hidden' name='change' value=1>";
print "<input type='submit' name='sub' value='Submit'></p></form>";
print "</td></tr>";
print "</table>\n";
if(isset($_POST['change'])) { // user submitted the form
$query = "UPDATE officehours SET hours='$poffice' WHERE id=1";
$result = mysql_query($query) or die("Query failed2");
}
mysql_close($dbconn); //closing connection to database
}
?>