Cita:
Iniciado por marcofbb
Porque te falto crear otro form para que actue con ?accion=testl
supongo que ahora est bien .. pero me sale esto
Notice: Undefined index: action in C:\xampp\htdocs\tab\area.php on line 34
no se que otro erros podria tener
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>Documento sin título</title>
<script type="text/JavaScript">
var procedenciaValida = new Array(
"buscar_codigo1.php","area.php"
);
var ok = false;
for(i in procedenciaValida) {
if(document.referrer.indexOf(procedenciaValida[i]) > -1) {
ok = true;
}
}
if(!ok) {
document.location.href="buscar_codigo1.php";
}
</script>
</head>
<body>
>
<img src="portada1.jpg" alt="" width="1100" height="200" align="top" />
<table width="1102" border="0">
<tr>
<td colspan="2" align="center"><p><strong>LAS AREAS DISPONIBLES SON LAS SIGUENTES</strong></p>
<p><?php
session_start();
include_once "conexion.php";
?>
<?php
if($_GET['action'] == "testm") {
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">Este Rut ya realizo el test de Matematicas</div>';
}
else
{
$cod = $_POST['cod'];
$rut = $_POST['rut'];
header("location:testm1.php?cod=$cod&rut=$rut");
}
}
} else {
function verificar_testl($rut,&$result)
{
$sql = "SELECT * FROM testl 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_testl($_POST['rut'],$result) == 1)
{
echo '<div class="error">Este Rut ya realizo el test de Lenguaje</div>';
}
else
{
$cod = $_POST['cod'];
$rut = $_POST['rut'];
header("location:testl1.php?cod=$cod&rut=$rut");
}
}
}
?></p></td>
</tr>
<tr>
<td width="539" align="right"><p>Codigo
:</p>
<p>
Rut: </p></td>
<td width="553" align="left"><p>
<input name="codigo" type="text" value="<?php
$cod = $_GET["cod"];
echo "$cod";
?>" readonly="readonly"/>
</p>
<p>
<input name="rut" type="text" value="<?php
$rut = $_GET["rut"];
echo "$rut";
?>" readonly="readonly"/>
</p></td>
</tr>
<tr>
<td align="right"><form action="?action=testm" method="get" name="testm"><input name="matematicas" type="submit" value="Matematicas"/>
</form>
<td align="left"><form action="?action=testl" method="get" name="testl"><input name="lenguaje" type="submit" value="Lenguaje"/> </form>
</td>
</tr>
</table>
</td>
<p> </p>
<p> </p>
<p><img src="divisor1.png" width="1100" height="10" alt="" /></p>
</body>
</html>