Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Gestión de proyectos y seminarios</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function validar(){
var bOk = true;
with (document.adm){
if (Nombre.value == ""){
alert("Faltan campos por rellenar");
Nombre.focus();
bOk = false;
}
else {
if (Apellidos.value == ""){
alert("Faltan campos por rellenar");
Apellidos.focus();
bOk = false;
}
else{
if((CodProfesor.value)==""){
alert("Faltan campos por rellenar");
CodProfesor.focus();
bOk=false;
}
else{
if(Asignatura.value==""){
alert("Faltan campos por rellenar");
Asignatura.focus();
bOk=false;
}
}
}
}
if (bOk)
submit();
}
}
</script>
</head>
<body bgColor="#cddcdc">
<form name='adm'method="post" action="administrador.php">
<div align="center">
<p><strong>GESTIÓN DE PROFESORADO</strong></p>
<p align="left"><a href="#">Ver lista de profesores autorizados</a></p>
</div>
<p> </p>
<p>Nombre
<input name="Nombre" type="text" size="25" maxlength="50" style="Z-INDEX: 106; LEFT: 98px; POSITION: absolute; TOP: 132px; width: 183px; height: 15px;" runat="server"
width="184px" height="24px">
</p>
<p>Apellidos
<input name="Apellidos" type="text" size="25" maxlength="50" style="Z-INDEX: 107; LEFT: 99px; POSITION: absolute; TOP: 168px; width: 183px; height: 16px;"
runat="server" Width="184px" Height="24px">
</p>
<p>Cod.Profesor
<input name="CodProfesor" type="text" size="25" maxlength="15" style="Z-INDEX: 108; LEFT: 99px; POSITION: absolute; TOP: 207px; width: 184px; height: 16px;"
runat="server" width="184px" height="24px">
</p>
<p>Asignatura
<input name="Asignatura" type="text" size="25" maxlength="50" style="Z-INDEX: 109; LEFT: 98px; POSITION: absolute; TOP: 243px; height: 17px; width: 186px;"
runat="server" width="184px" height="24px">
</p>
<div>
<p>
<input name="Modificar" type="button" value="Modificar" style="Z-INDEX: 112; LEFT: 80px; POSITION: absolute; TOP: 297px; width: 105px;" runat="server" width="120px">
</p>
</div>
<div>
<p>
<input name="Añadir" type="button" value="Añadir" style="Z-INDEX: 110; LEFT: 203px; POSITION: absolute; TOP: 297px; width: 102px;" runat="server" onclick='validar()' width="120px">
</p>
</div>
<p> </p>
</form>
</body>
</html>