science-ation/config/dates.php
james 43cf64ee89 Add dates configuration
fix variables to POST to the right page
add dates to config index
2005-01-14 15:44:36 +00:00

38 lines
1.2 KiB
PHP

<?
require("../common.inc.php");
send_header("Configuration - Dates");
echo "<a href=\"index.php\">&lt;&lt; ".i18n("Back to Configuration")."</a><br />";
if($_POST['action']=="save")
{
if($_POST['savedates'])
{
foreach($_POST['savedates'] as $key=>$val)
{
mysql_query("UPDATE dates SET date='".mysql_escape_string(stripslashes($val))."' WHERE year='".$config['FAIRYEAR']."' AND id='$key'");
}
}
echo happy(i18n("Dates successfully saved"));
}
$q=mysql_query("SELECT * FROM dates WHERE year=0 ORDER BY var");
echo "<form method=\"post\" action=\"dates.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
echo "<table>";
echo "<tr><td colspan=\"3\"><h3>".i18n("Dates for fair year %1",array($config['FAIRYEAR']))."</h3></td></tr>";
$q=mysql_query("SELECT * FROM dates WHERE year='".$config['FAIRYEAR']."' ORDER BY date");
while($r=mysql_fetch_object($q))
{
echo "<tr><td>$r->name</td><td>".i18n($r->description)."</td><td><input type=\"text\" name=\"savedates[$r->id]\" value=\"$r->date\" /></td></tr>";
}
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Save Dates")."\" />\n";
echo "</form>";
send_footer();
?>