You are on page 1of 7

ej3.

php
<html>
<body>
<?php
$error=false;
if
(isset($_POST['buscar'])
&&
$_POST['buscar'] == 'buscar') {
if ($_POST['nombre_apellido'] == '') {
$error=true; ?>
Por favor indique su nombre y apellido.<br>
<?php
}
if ($_POST['email'] == '') {
$error=true;?>
Por favor indique su direccion de email.<br>
<?php
}
if ($_POST['texto'] == '') {
$error=true; ?>
Por
favor
escriba
un
comentario
o
consulta.<br> <?php
}
}

guardaruno.php
<HTML>
<HEAD>
<TITLE>Guardar en BD </TITLE>
</HEAD>
<BODY BGCOLOR="#BLUE">
<?php
include("conecbd.php");
$link=Conectarse();
$nomape=$_POST['nombre_apellido'];
$correo
= $_POST['email'];
$comentario
= $_POST['texto'];
mysql_query("INSERT INTO tabla1 (nom_ape,
cor_per, com_per)
VALUES ('$nomape','$correo','$comentario')",
$link);
// Ahora comprobaremos que todo ha ido
correctamente
$my_error = mysql_error($link);

//cerramos la conexion
mysql_close($link);
?>
<h1><div align="center">
if (isset($_POST['buscar']) && $error ==
<font
face="ARIAL"
size="7"
false) {
color="WHITE">
include("guardaruno.php");
LOS DATOS INGRESADOS HAN
} else {
SIDO GUARDADOS *_*</font></div></h1>
?>
<td><a href="ej3.php"target=":self">
<form method="post" >
<center><input
type="submit"
Nombre y Apellido:
value="volver"></center></td>
<input type="text" name="nombre_apellido"
value="<?php echo
@$_POST['nombre_apellido']; ?>">
conecbd.php
<br>
<html>
E-Mail:
<head>
<input type="text" name="email" value="<? <title>Conexion base de datos</title>
php echo
</head>
@$_POST['email']; ?>">
<body>
<br>
<?php
Comente:
function Conectarse()
<br>
{
<textarea
name="texto"><?php
echo //conectarse a servidor
@$_POST['texto'];
if(!
?></textarea>
($link=mysql_connect("localhost","root","123")
<br>
))
<input type="submit" value="Enviar">
{
<input
name="buscar"
type="hidden" exit();
value="buscar">
}
</form>
//seleccionar base de datos
<?php
if(!mysql_select_db("unefabd1",$link))
}
{
?>
exit();
</body>
}
</html>
return $link;
}
Conectarse();
?>
</body>
</html>

<HTML>
<BODY>
<FORM METHOD="post" ACTION="consultar.php">
<head>
<title>Mantenimiento de Maerias</title></head>
<h2><center><u><b>MANTENIMIENTO DE MATERIAS</b></u></center></h2>
<hr color="#93DB70" size=10%>
<body bgcolor="#FFFFFF">
<div align="center"><h6>
<head>
<script language="JavaScript" type="text/javascript">
posArriba = 500
posIzquierda = 30
var anchoOp = 150
var menuPrin =4 // POR AHORA ES 4 ya que el menu tiene 4 opcion principal
var tunIex=navigator.appName=="Microsoft Internet Explorer"?true:false;
var tiempo
function menucete(ide,num){ // crea submenus principales (capa)
espan = document.createElement("span")
document.getElementById('Men_'+num).appendChild(espan)
espan.id=ide.toLowerCase(ide)+'_'+num
espan.className="subMe"
espan.cierra = true
espan.tiempo = 0
espan.style.top="-1px"
espan.onmouseout=function(){
setTimeout('ocultaP()',1000)
}
with(espan.style){
width = anchoOp+"px"
}
posIzquierda += anchoOp
construye(ide+'_'+num,eval('Op_'+num).subO)
}
function seccion(tex,enl,dstn,subO,an,dir){
this.tex = tex
this.enl = enl
this.dstn = dstn
this.subO = subO
this.dir = dir
this.an = an
}
var Op_0 = new seccion("Cargar Horarios",'',null,0)
var
var
var
var

Op_1 = new seccion("Reportes",'',null,5)


Op_1_0=new seccion('Profesores','',null,2)
Op_1_0_0=new seccion('Contratados','',null,0)
Op_1_0_1=new seccion('Titulares','',null,0)

var
var
var
var

Op_1_1=new
Op_1_2=new
Op_1_3=new
Op_1_4=new

seccion('Aulas','',null,0)
seccion('Trayecto/Trimestre',null,'',0)
seccion('Periodo Academico','',null,0)
seccion('Pensum','',null,0)

var
var
var
var
var

Op_2 = new seccion("Mantenimiento",'',null,4)


Op_2_0=new seccion('Profesores','',null,0)
Op_2_1=new seccion('Aulas',null,'',0)
Op_2_2=new seccion('Unidad Curricular','consultar.php',null,0)
Op_2_3=new seccion('Horarios','',null,0)

var Op_3 = new seccion("Cambiar Periodo",'',null,0)


var anchoTotal = 1; // aca el numero de opciones prin
if(!tunIex){anchoTotal += menuPrin*1} // aca se multiplicara por la cantidad de opciones
function menPrin(){ //crea menu principal
menuP=document.createElement('div')
tablaP = document.createElement('table')
tablaP.border=1
menuP.appendChild(tablaP)
cuerpoTabla = document.createElement('tbody')
tablaP.appendChild(cuerpoTabla)
fila=document.createElement('tr')
fila.id ='filita'
cuerpoTabla.appendChild(fila)
tablaP.cellSpacing='0'
tablaP.className='celda'
document.getElementById('tunMenu').appendChild(menuP)
menuP.className = "subMeP"
menuP.id = 'MenuPrincipal'
menuP.style.visibility='hidden'
menuP.style.position="absolute"
menuP.style.width = anchoTotal +"px"
for(s=0; s<menuPrin; s++){ //crea botones principales
opcionP=document.createElement('div')
opcionP.className = "botonesP"
opcionP.style.width= anchoOp+'px'
document.getElementById('MenuPrincipal').appendChild(opcionP)
opcionP.id='Men_'+s
opcionP.onclick=function(){
}
celda = document.createElement('td')
document.getElementById('filita').appendChild(celda)
celda.id='celda_' + s
celda.appendChild(opcionP)
celda.className='celda'
if(eval('Op_'+s).subO > 0){
menucete('Op',s)
}
}
}
var subs=new Array(0)
function construye(ide,num){
subOp=0
for(m=0; m<num; m++){
opchon = eval(ide +'_' + m)
caja = document.createElement("div")
boton = document.createElement("div")
boton.appendChild(caja)
caja.className='Caj'
document.getElementById(ide.toLowerCase()).appendChild(boton)
identi = ide.toLowerCase() + "_" + m
caja.id=identi+'caja'
boton.id = identi

boton.className = 'botones'
document.getElementById(identi).appendChild(document.createTextNode(opchon.tex))
salto = document.createElement('br')
boton.onmouseover=function(){
this.className='botonesHover'
this.parentNode.cierra=false
muestra(this.parentNode.id)
}
boton.onmouseout=function(){
this.className='botones'
this.parentNode.cierra = true
}
if(opchon.subO > 0){
subs[subs.length] = identi
subOp++
boton.style.cursor='default'
}
else{
boton.style.cursor=cur
if(opchon.enl!=null){
boton.enl=opchon.enl
boton.dstn=opchon.dstn
boton.onclick=function(){
enlaces(this.enl,this.dstn)
}
}
}
}
if(subs.length>0){construyeSub(subs)}
}
function construye2(ide,num){
for(m=0; m<num; m++){
opchon = eval(ide +'_' + m)
caja = document.createElement("div")
boton = document.createElement("div")
boton.appendChild(caja)
caja.className='Caj'
document.getElementById(ide.toLowerCase()+'_sub').appendChild(boton)
identi = ide.toLowerCase() + "_" + m
boton.id = identi
caja.id=identi+'caja'
boton.className = 'botones'
document.getElementById(identi).appendChild(document.createTextNode(opchon.tex))
salto = document.createElement('br')
boton.onmouseover=function(){this.className='botonesHover'}
boton.onmouseout=function(){this.className='botones'}
if(opchon.subO > 0){
subs[subs.length] = identi
subOp++
boton.style.cursor='default'
}
else{
boton.style.cursor=cur
if(opchon.enl!=null){
boton.enl=opchon.enl
boton.dstn=opchon.dstn
boton.onclick=function(){
enlaces(this.enl,this.dstn)
}

}
}
}
}
var cur=tunIex?'hand':'pointer'
function construyeSub(lista){
largo = subs.length
for(t=0; t<subs.length;t++){
if(subs[t] != null){
obj = subs[t].charAt(0).toUpperCase() + subs[t].substr(1)
obj2 = subs[t].charAt(0).toUpperCase() + subs[t].substring(1,subs[t].length2)
espan = document.createElement("span")
document.getElementById(subs[t]+'caja').appendChild(espan)
espan.id=subs[t]+'_sub'
espan.className="subMe"
espan.cierra = true
document.getElementById(subs[t]).onmouseover=function(){
this.className = 'botonesHover'
this.parentNode.cierra=false
muestra(this.id+'_sub')
}
document.getElementById(subs[t]).onmouseout=function(){
this.className = 'botones'
this.parentNode.cierra = true
oculta(this.id+'_sub')
}
espan.onclick=function(){
}
if(eval(obj2).an){An=eval(obj2).an}
else{An=anchoOp}
if(eval(obj).an){An2=eval(obj).an}
else{An2=anchoOp}
if(eval(obj).dir=='iz')
{pIz=-(An2-30)+"px"}
else{pIz=(An-30)+"px";}
with(espan.style){
position="absolute"
width = An2+"px"
left= pIz
visibility = 'hidden'
}
construye2(obj,eval(obj).subO)
subs[t] = null
}
}
}
function enlaces(enl,dstn){
if(dstn != null && dstn.toLowerCase() == 'nueva'){
window.open(enl)
}
else if(dstn==null){
location.href=enl
}
else{
eval(dstn+'.location.href='+enl)
}
}
function muestra(cual){
document.getElementById(cual).style.visibility='visible'

}
function oculta(cual){
document.getElementById(cual).style.visibility='hidden'
}
function ocultaP(){
for(y=0;y<menuPrin;y++){
if(document.getElementById('op_'+y)!=null){
if(document.getElementById('op_'+y).cierra){
document.getElementById('op_'+y).style.visibility='hidden'
}
}
}
}
function inicio(){
menuP=document.createElement('div')
tablaP = document.createElement('table')
tablaP.border=1
menuP.appendChild(tablaP)
cuerpoTabla = document.createElement('tbody')
tablaP.appendChild(cuerpoTabla)
fila=document.createElement('tr')
fila.id ='filitaP'
cuerpoTabla.appendChild(fila)
tablaP.cellSpacing='0'
tablaP.className='celda'
document.getElementById('tunMenu').appendChild(menuP)
menuP.className = "subMeP"
menuP.id = 'MenuPrincipalP'
menuP.style.width = anchoTotal+"px"
for(s=0; s<menuPrin; s++){ //crea botones principales
opcionP=document.createElement('div')
opcionP.className = "botones"
opcionP.style.width= anchoOp+'px'
opcionP.appendChild(document.createTextNode(eval('Op_'+s).tex))
document.getElementById('MenuPrincipalP').appendChild(opcionP)
opcionP.style.cursor = cur
opcionP.id='tuMen'+s
if(eval('Op_'+s).enl!=null){
opcionP.enl=eval('Op_'+s).enl
opcionP.dstn=eval('Op_'+s).dstn
opcionP.onclick=function(){
enlaces(this.enl,this.dstn)
}
}
celda = document.createElement('td')
document.getElementById('filitaP').appendChild(celda)
celda.id='celdaP_' + s
celda.appendChild(opcionP)
celda.className='celda'
}
for(n=0;n<menuPrin;n++){
document.getElementById('tuMen'+n).onmouseover=function(){
if(document.getElementById('op_'+this.id.substr(5))!=null){
clearTimeout(tiempo)
document.getElementById('op_'+this.id.substr(5)).cierra=false
ocultaP()
muestra('op_'+this.id.substr(5))
}
else{
clearTimeout(tiempo)

ocultaP()
}
}
document.getElementById('tuMen'+n).onmouseout=function(){
if(document.getElementById('op_'+this.id.substr(5))!=null){
document.getElementById('op_'+this.id.substr(5)).cierra=true
tiempo =setTimeout('ocultaP()',1000)
}
}
}
document.getElementById('tunMenu').style.width = anchoTotal + "px"
menPrin()
}
var activo = false
window.onload=inicio
</script>
<style type="text/css">
</style>
<table cellspacing="0" cellpadding="0" width="30%" bgcolor="#8A0808" border"1">
<!-- el porcentaje aumenta dependiendo el nro de opciones-->
<tbody>
<tr>
<td bgcolor="#FFFFFF" width="30%" border"2"></td>
<td bgcolor="#FFFFFF" >
<div id="tunMenu"></div>
<div style="margin-left: auto; margin-right: auto; width: 30%; font-family: trebuchet ms">
</div>
</td>
</div>
</tr>
</tbody>
</table>
<br><br>
</body>
</html>

You might also like