<?php
	require("§lib_inc.php");
?>
<HTML>
<BODY BGCOLOR=#FFFFFF FGCOLOR=0 background='fond.png'>
<form method="post" action="§save_param.php">
<?php
	echo "<CENTER><H1>";	
	display_lng_text("ADM_PARAM");
	echo "</H1>";

	echo "<table border=1 cellspacing=0><tr><th>";
	display_lng_text("ADM_PARAM_TYPE");
	echo "</th><th>";
	display_lng_text("ADM_PARAM_VALUE");
	echo "</th></tr>";
	$sql_query = "SELECT DISTINCT name FROM oxg_ref_param";
	$result = mysqli_query($_SESSION['dbh'],$sql_query) or mysqli_die();
	while($row = mysqli_fetch_array($_SESSION['dbh'],$result))
	{
		echo "<tr><td>$row[name]</td>";
		echo "<td><select name='$row[name]'>";
		$sql_query = "SELECT oxg_ref_param.value ref_val, oxg_param.value FROM oxg_param RIGHT JOIN oxg_ref_param ON oxg_ref_param.name=oxg_param.name WHERE oxg_ref_param.name='$row[name]'";
		$result_val = mysqli_query($_SESSION['dbh'],$sql_query) or mysqli_die();
		while($row_val = mysqli_fetch_array($_SESSION['dbh'],$result_val))
		{
			if($row_val[ref_val]==$row_val[value])
			{
				echo "<OPTION selected>";
			}
			else
			{
				echo "<OPTION>";
			}
			echo "$row_val[ref_val]</OPTION>";
		}
		echo "</select>";
		echo "</td></tr>";
	}
?>
</TABLE><br>
<input type="submit" value="OK">
</form>
</CENTER>
<br><br>
<?php
	affiche_pied_page_admin(true);
?>
</BODY>
</HTML>