Foros del Web » Programando para Internet » Javascript »

nueva ventana y cerrar

Estas en el tema de nueva ventana y cerrar en el foro de Javascript en Foros del Web. tengo el siguiente codigo en el cual necesito que cuando se carge el header("location:testm".$aleatorio.".php?cod=$cod& rut=$rut&nombre=$nombre&apellido=$apellido&ciudad= $ciudad"); lo haga en una nueva ventana y se cierre ...
  #1 (permalink)  
Antiguo 18/10/2012, 12:50
 
Fecha de Ingreso: enero-2004
Mensajes: 72
Antigüedad: 20 años, 3 meses
Puntos: 1
nueva ventana y cerrar

tengo el siguiente codigo

en el cual necesito que cuando se carge el header("location:testm".$aleatorio.".php?cod=$cod& rut=$rut&nombre=$nombre&apellido=$apellido&ciudad= $ciudad"); lo haga en una nueva ventana y se cierre la actual

"el fin de esto que que no puedan volver a la web anterior con atras "


Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/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>MATEMATICAS</title>
<script type="text/JavaScript">
var procedenciaValida = new Array(
"area.php","matematicas.php"
);
var ok = false;
for(i in procedenciaValida) {
if(document.referrer.indexOf(procedenciaValida[i]) > -1) {
ok = true; 
}
}
if(!ok) {
document.location.href="index2.php"; 
}
</script>
<style type="text/css">
dc {
    font-family: Arial;
}
#form1 table tr td p .dc {
    font-family: Arial;
}
#form1 table {
    font-family: Arial;
}
#form1 table tr td p .dc {
    text-align: justify;
    font-family: Arial;
}
#form1 table tr td .dc {
    text-align: justify;
    font-family: Arial;
}
</style>
</head>
<body>
<p>
  <script languaje="javascript">
function validar(){
    if(form1.nombre.value==''){
        alert('ingrese su nombre');
        form1.nombre.focus();
        return false;
    }
    if(form1.apellido.value==''){
        alert('ingrese su apellido');
        form1.apellido.focus();
        return false;
}
    if(form1.ciudad.value==''){
        alert('ingrese su ciudad');
        form1.ciudad.focus();
        return false;
}
}
</script>
  <script>
function validarNro(e) {
var key;
if(window.event) // IE
    {
    key = e.keyCode;
    }
else if(e.which) // Netscape/Firefox/Opera
    {
    key = e.which;
    }

if (key < 48 || key > 57)
    {
    if(key == 46 || key == 8) // Detectar . (punto) y backspace (retroceso)
        { return true; }
    else 
        { return false; }
    }
return true;
}
</script>
<form id="form1" name="form1" method="post" action="" onsubmit="return validar();">
  <table width="1100" border="0">
                <tr>
                  <td width="150" align="left"><p>&nbsp;</p></td>
                  <td colspan="2" align="justify"><p class="dc">&nbsp;</p></td>
                  <td width="150" align="left">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="4" align="center">
                                    
                  <?php 
     session_start
();
    include_once 
"conexion.php";
         
header("Content-Type: text/html;charset=utf-8");
?>
                  <?php
   
    
function verificar_testm($rut,&$result)    
    {
        
$sql "SELECT * FROM testm WHERE rut = '$rut'";
        
$rec mysql_query($sql);
        
$count 0;
        while(
$row mysql_fetch_object($rec))
        {
            
$count++;
            
$result $row;
        }
        if(
$count == 1)
        {
            return 
1;
        }
        else
        {
            return 
0;
        }
    }
    
        if(isset(
$_POST['rut']))
        {
            if(
verificar_testm($_POST['rut'],$result) == 1)
            {
             echo 
'<div class="error"><strong>El test al cual se quiere acceder, ya fue rendido previamente</strong></div>';
                        }
            else
            {
                
$cod $_POST['cod'];
                        
$rut $_POST['rut'];
                        
$nombre $_POST['nombre'];
                        
$apellido $_POST['apellido'];
                        
$ciudad $_POST['ciudad'];
                        
$aleatorio=rand(1,3);
                        
header("location:testm".$aleatorio.".php?cod=$cod&rut=$rut&nombre=$nombre&apellido=$apellido&ciudad=$ciudad");
                
            }
        }
?></td>
                </tr>
                <tr>
                  <td align="center">&nbsp;</td>
                  <td width="393" align="right">Codigo: </td>
                  <td width="389" align="left"><input name="cod" type="text" value="<?php 
$cod 
$_GET["cod"]; 
echo 
"$cod"
?>" readonly="readonly"/></td>
                  <td align="center">&nbsp;</td>
                </tr>
                <tr>
                  <td align="center">&nbsp;</td>
                  <td align="right">Rut: </td>
                  <td align="left"><input name="rut" type="text" onkeypress="javascript:return validarNro(event)" value="<?php 
$rut 
$_GET["rut"]; 
echo 
"$rut"
?>" readonly="readonly"/></td>
                  <td align="center">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="4" align="center">&nbsp;</td>
                </tr>
                <tr>
                  <td align="center">&nbsp;</td>
                  <td align="right">Nombre: </td>
                  <td align="left"><input type="text" name="nombre" id="nombre" /></td>
                  <td align="center">&nbsp;</td>
                </tr>
                <tr>
                  <td align="center">&nbsp;</td>
                  <td align="right">Apellido:</td>
                  <td align="left"><input type="text" name="apellido" id="apellido" /></td>
                  <td align="center">&nbsp;</td>
                </tr>
                <tr>
                  <td align="center">&nbsp;</td>
                  <td align="right">Ciudad:</td>
                  <td align="left"><input type="text" name="ciudad" id="ciudad" /></td>
                  <td align="center">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="4" align="center">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="4" align="center"><input name="login" type="submit" value="Comenzar Test"/></td>
                </tr>
                <tr>
                  <td colspan="4" align="center"><span class="login">
                  <input type="button" value="Volver "  onclick="history.back(-2)" />
                  </span></td>
                </tr>
  </table>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</form>
<p>&nbsp;</p>
  <p><img src="divisor1.png" width="1100" height="10" alt="" /></p>
<script language="Javascript">
document.oncontextmenu = function(){return false};
</script>    
</body>
</html>
  #2 (permalink)  
Antiguo 18/10/2012, 13:04
Avatar de maycolalvarez
Colaborador
 
Fecha de Ingreso: julio-2008
Ubicación: Caracas
Mensajes: 12.120
Antigüedad: 15 años, 8 meses
Puntos: 1532
Respuesta: nueva ventana y cerrar

php no puede abrir ventanas modales, eso es con Javascript, a lo sumo en vez de header location imprima un script window.open para un popup, o el código de alguna librería JS para ventanas tipo modal, como jQueryUI con AJAX

reportado al foro de Javascript para que sea movido
__________________
¡Por favor!: usa el highlight para mostrar código
El que busca, encuentra...

Etiquetas: cerrar, html, mysql, sql, ventanas
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:24.