<?php
session_start();

if (!session_is_registered("clave_audio")) {
	include("../login.php");
	if (!$continuar) exit;
}

include('../db.php');
?>
<html>
<head>
<title>secciones</title>
<link href="../sformi.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
function doSubmit() { 
	document.formulario.submit();
}
</script>
</head>
<body>
<?php 

if(isset($_REQUEST['op'])) {
	$operacion = $_REQUEST['op'];
	$id = $_REQUEST['id'];
} else {
	$operacion = "add";
}

?>
<?php
$seccion_orden = "";
$seccion_nombre = "";
$seccion_descripcion = "";
$seccion_code = "";

switch($operacion)
{
	case "add";

		break;

	case "edit";
		$conn = db_connect();
		if($conn) {
			$query = "SELECT seccion_id, seccion_orden, seccion_nombre, seccion_descripcion, seccion_code FROM shoop_secciones WHERE seccion_id = " . $id;
			$result = mysql_query($query, $conn);
			if (mysql_num_rows($result)) {
				$row = mysql_fetch_array($result);
				$seccion_orden = $row['seccion_orden'];
				$seccion_nombre = $row['seccion_nombre'];
				$seccion_descripcion = $row['seccion_descripcion'];
				$seccion_code = $row['seccion_code'];
			}
		}
		break;
}
?>
<form method="post" action="secciones_db.php" name="formulario">
<input name="op" type="hidden" value="<?php echo $operacion; ?>">
<input name="id" type="hidden" value="<?php echo $id; ?>">
<table border="0" cellspacing="0" cellpadding="0">
<tr><td width="200" class= "lbl">C&oacute;digo</td></tr>
	<tr><td width="" class="data"><input name="seccion_code" type="text" size="2" maxlength="2" value="<?php echo $seccion_code; ?>" class="data"></td></tr>
	<tr><td><img src="../_imgs/d.gif" width="100" height="3"></td></tr>
<tr><td width="200" class= "lbl">Orden</td></tr>
	<tr><td width="" class="data"><input name="seccion_orden" type="text" size="2" maxlength="2" value="<?php echo $seccion_orden; ?>" class="data"></td></tr>
	<tr><td><img src="../_imgs/d.gif" width="100" height="3"></td></tr>
<tr><td width="200" class= "lbl">Nombre</td></tr>
	<tr><td width="" class="data"><input name="seccion_nombre" type="text" size="30" maxlength="30" value="<?php echo $seccion_nombre; ?>" class="data"></td></tr>
	<tr><td><img src="../_imgs/d.gif" width="100" height="3"></td></tr>
<tr><td width="200" class= "lbl">Descripci&oacute;n</td></tr>
	<tr><td width="" class="data"><textarea name="seccion_descripcion" cols="40" rows="2" class="data"><?php echo $seccion_descripcion; ?></textarea></td></tr>
	<tr><td><img src="../_imgs/d.gif" width="100" height="3"></td></tr>
<tr>
	<td>
		<a href="javascript:history.go(-1)" class="button">[ volver atr&aacute;s ]</a>&nbsp;&nbsp;
		<a href="javascript:doSubmit();" class="button">[ grabar ]</a></td></tr>
</table>
</form>
</body>
</html>