Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/02/2012, 14:57
Avatar de erick_reyesg
erick_reyesg
 
Fecha de Ingreso: enero-2012
Ubicación: Guatemala
Mensajes: 53
Antigüedad: 12 años, 3 meses
Puntos: 2
Consulta envio de formulario plz

buenos dias mi consulta es la siguiente tengo un formulario que es un test de 3 preguntas este cuestionario tiene usuario y fecha lo que quiero hacer es que cuando el usuario envie su cuestionario y este se guarde en la db si quiere volver a ingresar al test le muestre un mensaje de ya te has evaluado hoy de lo contrario muestre el formulario ya tengo un archivo que he creado pero me da errores como por ejm hace la comparacion y muestra ya te has evaluado hoy pero sigue desplegando el formulario o el usuario hace el test y no le muestra nada por q??

este es el archivo que he creado
Código PHP:
    <?php
    $usuario 
$_COOKIE['loggedin'];
    if (!isset(
$_COOKIE['loggedin'])) die("<center><img src='images/error.png'><br><div id='miclase'>No te has identificado, <a href=index.html>click ac&aacute;</a> para iniciar sesi&oacute;n.</center>");
     
    include (
"config.php");
    
mysql_connect($server$db_user$db_pass) or die (mysql_error());
    
$result mysql_db_query($database"select * from $table WHERE usuario = '$usuario'") or die (mysql_error());
       while (
$qry mysql_fetch_array($result)) {
    echo 
"Usuario: <input type='text'  name='matricula' size='8' readonly value='$usuario'>&nbsp;&nbsp;&nbsp;";
    echo 
"Fecha &nbsp;&nbsp;&nbsp;";
    
$fecha date('d/m/y');
    echo 
$fecha;
    echo 
"<br><br>";
     
        
$conexion mysql_connect("localhost""root""ene2012");
        
mysql_select_db("usuarios"$conexion);
        
$queEmp "SELECT * FROM notas_cues";
        
$resEmp mysql_query($queEmp$conexion) or die(mysql_error());
        
$totEmp mysql_num_rows($resEmp);      
     
        if (
$totEmp0) {
           while (
$rowEmp mysql_fetch_assoc($resEmp)) {
    
$not $rowEmp['nota'];
    
$user $rowEmp['usuario'];
    
$fech $rowEmp['fecha'];
     
    if (
$user == $usuario  && $fech == $fecha){
        echo 
"Ya Te Evaluaste Hoy tu nota es $not <br><br>";
        echo 
"<a href='form.php'>Volver</a>";
           }
           else{
$conexion mysql_connect("localhost""root""ene2012");
    
mysql_select_db("usuarios"$conexion);
    
$queEmp "SELECT * FROM cuestionario";
    
$resEmp mysql_query($queEmp$conexion) or die(mysql_error());
    
$totEmp mysql_num_rows($resEmp);      
echo 
"<form action='resultado.php' method='post' name='formulario'>";
echo 
"<table>";
    if (
$totEmp0) {
       while (
$rowEmp mysql_fetch_assoc($resEmp)) {
       
$corre1 $rowEmp['corre1'];
       
$corre2 $rowEmp['corre2'];
       
$corre3 $rowEmp['corre3'];
       
$corre4 $rowEmp['corre4'];        
           
          echo 
"<strong>".$rowEmp['pregunta1']."</strong><br>";
          echo 
"<tr><td><input type='radio' name='Res1' value='1'>";
          echo 
"".$rowEmp['1res1']."<br>";
    echo 
"<input type='radio' name='Res1' value='2'>";
          echo 
"".$rowEmp['1res2']."<br>"
    echo 
"<input type='radio' name='Res1' value='3'>";
          echo 
"".$rowEmp['1res3']."<br>"
    echo 
"<input type='radio' name='Res1' value='4'>";
          echo 
"".$rowEmp['1res4']."<br></td></tr>";   
echo 
"</table><br>";
 
 
echo 
"<table>";
          echo 
"<strong>".$rowEmp['pregunta2']."</strong><br>";
          echo 
"<tr><td><input type='radio' name='Res2' value='1'>";
          echo 
"".$rowEmp['2res1']."<br>";
    echo 
"<input type='radio' name='Res2' value='2'>";
          echo 
"".$rowEmp['2res2']."<br>"
    echo 
"<input type='radio' name='Res2' value='3'>";
          echo 
"".$rowEmp['2res3']."<br>"
    echo 
"<input type='radio' name='Res2' value='4'>";
          echo 
"".$rowEmp['2res4']."<br></td></tr>";   
echo 
"</table><br>";
echo 
"<br>";
 
 
 
echo 
"<table>";
          echo 
"<strong>".$rowEmp['pregunta3']."</strong><br>";
          echo 
"<tr><td><input type='radio' name='Res3' value='1'>";
          echo 
"".$rowEmp['3res1']."<br>";
    echo 
"<input type='radio' name='Res3' value='2'>";
          echo 
"".$rowEmp['3res2']."<br>"
    echo 
"<input type='radio' name='Res3' value='3'>";
          echo 
"".$rowEmp['3res3']."<br>"
    echo 
"<input type='radio' name='Res3' value='4'>";
          echo 
"".$rowEmp['3res4']."<br></td></tr>";   
echo 
"</table><br>";
       }
    }
 
echo 
"<input type='image' src='images/nota.png' />";
echo 
"</form>";  
       }
    }
   }
   }
    
?>
__________________
No hay Mayor señal de Ignoracia que creer imposible lo Inexplicable