Está en la página 1de 7

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.

or
g/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Agregar Docente</title>
<link href="Style/Add_Form.css" rel="stylesheet" type="text/css"
/>
</head>

<body bgcolor="#000000" background="Images/2head.jpg">


<div class="img"><img src="Images/auditoria.png" /></div>
<div class="ii"><center><img src="Images/Edit_Yes.png" style="margin-top:5px"/><
/center></div>
<div id="topbar">
<center><h1 style="color:#FFFFFF">Captura de Docentes</h1>
</div>
<div id="form">
<table>
<form method="post" action="">
<tr>
<?php
include ("connect.php");
$g = mysql_query("select max(teaid) from teacher");
while($id=mysql_fetch_array($g))
{
?>
<th>ID:</th>
<td><input type="text" name="txtid" value="<?php echo $id[0]+1; ?>" readonly="re
adonly" /></td>
</tr>
<?php

}
?>
<tr>
<th>Nombre:</th>
<td><input type="text" name="txtname" placeholder="Type Name" /></td>
<th>Genero:</th>
<td><select name="txtgender">
<option>Selecciona el Genero</option>
<option>Masculino</option>
<option>Femenino</option>
</select>
</td>
</tr>
<tr>
<th>Fecha de Nacimiento:</th>
<td>
<select name="txtday">
<option>Dia</option>
<?php
//Do Loop while
$d=0;
do{
$d++;
echo "<option>".$d."</option>";
}while($d<=30);
?>
</select>
<select name="txtmonth">
<option>Mes</option>
<?php

//For Loop
$m=array("Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"
);
for($i=0;$i<count($m);$i++){
echo"<option>".$m[$i]."</option>";
}
?>
</select>
<select name="txtyear">
<option>Ao</option>
<?php
//While Loop
$y=2021;
while($y>=1950){
$y--;
echo "<option>".$y."</option>";
}
?>
</select>
</td>
<th>Direccion:</th>
<td><textarea cols="19px" rows="3" name="txtaddress" placeholder="Escribe tu Dir
eccion" /></textarea></td>
</tr>
<tr>
<tr>
<th>Email:</th>
<td><input type="text" name="txtemail" placeholder="Escribe direccion de Email"
/></td>
<th>Telefono:</th>
<td><input type="text" name="txtphone" placeholder="Escribe Num. Telefono" /></t
d>

</tr>
<tr>
<th>Fecha de Ingreso a DGETI:</th>
<td>
<select name="txtday2">
<option>Dia</option>
<?php
//Do Loop while
$d=0;
do{
$d++;
echo "<option>".$d."</option>";
}while($d<=30);
?>
</select>
<select name="txtmonth2">
<option>Mes</option>
<?php
//For Loop
$m=array("Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"
);
for($i=0;$i<count($m);$i++){
echo"<option>".$m[$i]."</option>";
}
?>
</select>
<select name="txtyear2">
<option>Ao</option>
<?php
//While Loop

$y=2021;
while($y>=1950){
$y--;
echo "<option>".$y."</option>";
}
?>
</select>
</td>
</tr>
<tr>
<th>Grado Academico:</th>
<td>
<select name="txtacademic">
<option>Selecciona Grado Academico</option>
<?php
$s=array("Tecnicos","Licenciatura","Maestria","Doctorado");
for($i=0;$i<count($s);$i++)
{
echo "<option>".$s[$i]."</option>";
}
?>
</select>
</td>
<th>Institucion:</th>
<td><input type="text" name="txtinst" placeholder="Escribe el nombre de la insti
tucion" /></td>
</tr>
<tr>
<th>Generacion: </th>
<td><input type="text" name="txtgen" placeholder="" /></td>
<th>Materia:</th>
<td>

<select name="txtsubject">
<option>Selecciona la Materia</option>
<?php
$s=array("Java Script","VB.NET","Graphic Design","PHP & MySQL","C#","C","C++","V
BA","HTML and CSS");
for($i=0;$i<count($s);$i++)
{
echo "<option>".$s[$i]."</option>";
}
?>
</select>
</td>
</tr>
<th>Folio de Registro:</th>
<td><input type="text" name="txtfolio" placeholder="Folio de Registro" /></td>
<th>Folio de dictamen favorable:</th>
<td><input type="text" name="txtdic" placeholder="Folio de dictamen favorable" /
></td>
</tr>
<th>Antiguedad:</th>
<td><input type="text" name="txtant" placeholder="antiguedad" /></td>
<th>Horas nombramiento:</th>
<td><input type="text" name="txtnomb" placeholder="H. Nombramiento" /></td>
</tr>
<tr>
<th>Fecha de Captura:</th>
<td><input type="text" name="txtdate" value="<?php echo date("d/M/Y"); ?>" reado
nly="readonly" /></td>
</tr>
<tr>
<td><input type="submit" name="cmdadd" value="Agregar" /></td>
<td><input type="reset" name="cmdreset" value="Clear"/></td>

</tr>
</form>
</table>
</div>
<?php
$id = $_POST['txtid'];
$name = trim($_POST['txtname']);
$gender = trim($_POST['txtgender']);
$dob = trim($_POST['txtday']."/".$_POST['txtmonth']."/".$_POST['txtyear'
]);
$address = trim($_POST['txtaddress']);
$sub = trim($_POST['txtsubject']);
$date = trim($_POST['txtdate']);
$ant2 = trim($_POST['txtant']);
$hno = trim($_POST['txtnom']);
if(isset($_POST['cmdadd'])){
if(empty($name) || $gender=="Select Gender" || $_POST['txtday']=="Day" |
| $_POST['txtmonth']=="Month" || $_POST['txtyear']=="Year" || empty($address) ||
$subject=="Select Subject")
{
echo "<center>Sorry please input data</center>";
}else{
include "connect.php";
$i = mysql_query("insert into teacher values('".$id."','".$name."','".$g
ender."','".$dob."','".$address."','".$sub."','".$date."','".$ant2."','".$hno."'
)");
if($i==true){
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=index.php">';
}
//if($i==true){
//header('Location:index.php');
//exit;
//mysql_close();
//}
}
}
?>
</body>
</html>

También podría gustarte