Location: PHPKode > projects > Uniweb > Uniweb/admin/asignatura_inserta.php
<?
if(isset($insertar)){
$sql_inserta_as = "INSERT into asignaturas values(null,'$nombre','$id_curso','','$barraestado','$profesor','$email_prof','$comentario')";
mysql_query($sql_inserta_as);
$sql_as = "select id_asignatura from asignaturas order by id_asignatura DESC";
$result_as = mysql_query($sql_as);
$row_as = mysql_fetch_array($result_as);
$id_asignatura = $row_as['id_asignatura'];
$link = "index.php?dcha=patron.php&seccion=".$id_asignatura;
$sql_update_as = "UPDATE asignaturas set link='$link' where id_asignatura = '$id_asignatura'";
mysql_query($sql_update_as);
$mydir = $row_uniweb['path_apuntes']."/".$id_asignatura;
mkdir("$mydir", 0777);
echo "<div align=\"right\"><font size=\"1\" color=\"990000\" face=\"arial\"><b>Actualizado la Asignatura  correctamente</b></font></div>";	
}
?>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr>
    <td> 
      <div align=center><span class="tit02"><b>Inserta Asignatura</b></span></div>
    </td></tr></table>
<br>
<?
if ($selecciona == ""){
?>
<form action="<? $PHP_SELF ?>" method="post">
  <input type="hidden" name="dcha" value="<? echo $dcha ?>">
  <input type="hidden" name="panel" value="<? echo $panel ?>">
  <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td>
<table width="40%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td colspan="2"><div align="center"><span class="texto01"><strong>Elige Grupo</strong></span></div></td>
        </tr>
        <tr bgcolor="#CCCCCC"> 
          <td colspan="2"></td>
        </tr>
		<tr> 
          <td height="29"><span class="texto01"><b>Grupo:</b></span></td>
          <td><select name="grupo" id="grupo" style="BORDER-RIGHT: #6699CC 1px solid; BORDER-TOP: #6699CC 1px solid; FONT-SIZE: 9px; BACKGROUND: #FFFFFF; BORDER-LEFT: #6699CC 1px solid; COLOR: #000000; BORDER-BOTTOM: #6699CC 1px solid; FONT-FAMILY: verdana">
              <option value="ITIS">Cursos (Primero, Segundo...)</option>
              <option value="">Varios (Manuales,Exámenes ...)</option>
            </select></td>
        </tr>
      </table>
	    <br>
          <div align="center"><input style="BORDER-RIGHT: #eeeeee 1px solid; BORDER-TOP: #eeeeee 1px solid; BACKGROUND: <? echo $row_conf['conf_color_boton'] ?>; FONT: 8pt verdana; BORDER-LEFT: #eeeeee 1px solid; COLOR: #ffffff; BORDER-BOTTOM: #eeeeee 1px solid" type=submit value="Seleccionar" name=selecciona></div>
</form>
<?
}else{
?>
<form action="<? $PHP_SELF ?>" method="post">
  <input type="hidden" name="dcha" value="<? echo $dcha ?>">
  <input type="hidden" name="panel" value="<? echo $panel ?>">
    <input type="hidden" name="grupo" value="<? echo $grupo ?>"> 
  <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td>
<table width="40%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td colspan="2"><div align="center"><span class="texto01"><strong>Insertar 
              Asignatura</strong></span></div></td>
        </tr>
        <tr bgcolor="#CCCCCC"> 
          <td colspan="2"></td>
        </tr>
        <tr> 
          <td><span class="texto01"><b>Nombre:</b></span></td>
          <td><input name="nombre" type="text" style="BORDER-RIGHT: #6699CC 1px solid; BORDER-TOP: #6699CC 1px solid; FONT-SIZE: 9px; BACKGROUND: #FFFFFF; BORDER-LEFT: #6699CC 1px solid; COLOR: #000000; BORDER-BOTTOM: #6699CC 1px solid; FONT-FAMILY: verdana" size="50"></td>
        </tr>
        <tr> 
          <td height="29"><span class="texto01"><b>Grupo:</b></span></td>
          <td><select name="id_curso" id="id_curso" style="BORDER-RIGHT: #6699CC 1px solid; BORDER-TOP: #6699CC 1px solid; FONT-SIZE: 9px; BACKGROUND: #FFFFFF; BORDER-LEFT: #6699CC 1px solid; COLOR: #000000; BORDER-BOTTOM: #6699CC 1px solid; FONT-FAMILY: verdana"><?
	$sql_cursos = "select * from cursos where grupo = '$grupo'";
	$result_cursos = mysql_query($sql_cursos);
	while ($row_cursos = mysql_fetch_array($result_cursos)){
		echo "<option value=\"".$row_cursos['id_curso']."\">".$row_cursos['curso']."</option>";
    }
	?></select></td>
        </tr>
        <tr> 
          <td><span class="texto01"><b>Comentario corto:</b></span></td>
          <td><input name="barraestado" type="text" id="barraestado" style="BORDER-RIGHT: #6699CC 1px solid; BORDER-TOP: #6699CC 1px solid; FONT-SIZE: 9px; BACKGROUND: #FFFFFF; BORDER-LEFT: #6699CC 1px solid; COLOR: #000000; BORDER-BOTTOM: #6699CC 1px solid; FONT-FAMILY: verdana" size="50"></td>
        </tr>
		<?
if ($grupo != ""){
?>
        <tr> 
          <td><span class="texto01"><b>Profesor:</b></span></td>
          <td><input name="profesor" type="text" id="profesor" style="BORDER-RIGHT: #6699CC 1px solid; BORDER-TOP: #6699CC 1px solid; FONT-SIZE: 9px; BACKGROUND: #FFFFFF; BORDER-LEFT: #6699CC 1px solid; COLOR: #000000; BORDER-BOTTOM: #6699CC 1px solid; FONT-FAMILY: verdana" size="50"></td>
        </tr>
        <tr> 
          <td><span class="texto01"><b>Email Profesor:</b></span></td>
          <td><input name="email_prof" type="text" id="email_prof" style="BORDER-RIGHT: #6699CC 1px solid; BORDER-TOP: #6699CC 1px solid; FONT-SIZE: 9px; BACKGROUND: #FFFFFF; BORDER-LEFT: #6699CC 1px solid; COLOR: #000000; BORDER-BOTTOM: #6699CC 1px solid; FONT-FAMILY: verdana" size="50"></td>
        </tr>
        <tr> 
          <td valign="top"><span class="texto01"><b>Observaciones Asignatura:</b></span></td>
          <td><textarea name="comentario" cols="50" style="BORDER-RIGHT: #6699CC 1px solid; BORDER-TOP: #6699CC 1px solid; FONT-SIZE: 9px; BACKGROUND: #FFFFFF; BORDER-LEFT: #6699CC 1px solid; COLOR: #000000; BORDER-BOTTOM: #6699CC 1px solid; FONT-FAMILY: verdana"></textarea></td>
        </tr>
		<?
		}
		?>
      </table>
	    <br>
          <div align="center"><input style="BORDER-RIGHT: #eeeeee 1px solid; BORDER-TOP: #eeeeee 1px solid; BACKGROUND: <? echo $row_conf['conf_color_boton'] ?>; FONT: 8pt verdana; BORDER-LEFT: #eeeeee 1px solid; COLOR: #ffffff; BORDER-BOTTOM: #eeeeee 1px solid" type=submit value="Insertar" name=insertar></div>
</form>
<?
}
?><br>
<div align=center><a href=index.php?dcha=panel.php&panel=menupanelasign.php>[Panel de Asignaturas]</a></div>
<br>
Return current item: Uniweb