Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/02/2012, 12:34
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
Respuesta: Consulta deshabilitar form php

he puesto esto y si el usuario ya tiene nota muestra el mensaje ya te has evaluado hoy pero no logro conseguir que me muestre el formulario si el usuario aun no se ha evaluado
Código PHP:
Ver original
  1. <?php
  2. $usuario = $_COOKIE['loggedin'];
  3. 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>");
  4.  
  5. include ("config.php");
  6. mysql_connect($server, $db_user, $db_pass) or die (mysql_error());
  7. $result = mysql_db_query($database, "select * from $table WHERE usuario = '$usuario'") or die (mysql_error());
  8.    while ($qry = mysql_fetch_array($result)) {
  9. echo "Usuario: <input type='text'  name='matricula' size='8' readonly value='$usuario'>&nbsp;&nbsp;&nbsp;";
  10. echo "Fecha &nbsp;&nbsp;&nbsp;";
  11. $fecha = date('d/m/y');
  12. echo $fecha;
  13. echo "<br><br>";
  14.  
  15.     $conexion = mysql_connect("localhost", "root", "ene2012");
  16.     mysql_select_db("usuarios", $conexion);
  17.    
  18.    
  19.      
  20.     $queEmp = "SELECT * FROM notas_cues";
  21.     $resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
  22.     $totEmp = mysql_num_rows($resEmp);      
  23.  
  24.     if ($totEmp> 0) {
  25.        while ($rowEmp = mysql_fetch_assoc($resEmp)) {
  26. $not = $rowEmp['nota'];
  27. $user = $rowEmp['usuario'];
  28. $fech = $rowEmp['fecha'];
  29.  
  30. if ($user == $usuario  && $fech == $fecha){
  31.     echo "Ya Te Evaluaste Hoy tu nota es $not <br><br>";
  32.     echo "<a href='form.php'>Volver</a>";
  33.        }
  34.        else{
  35.               $conexion = mysql_connect("localhost", "root", "ene2012");
  36.     mysql_select_db("usuarios", $conexion);
  37.     $queEmp = "SELECT * FROM cuestionario";
  38.     $resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
  39.     $totEmp = mysql_num_rows($resEmp);      
  40. echo "<form action='resultado.php' method='post' name='formulario'>";
  41. echo "<table>";
  42.     if ($totEmp> 0) {
  43.        while ($rowEmp = mysql_fetch_assoc($resEmp)) {
  44.        $corre1 = $rowEmp['corre1'];
  45.        $corre2 = $rowEmp['corre2'];
  46.        $corre3 = $rowEmp['corre3'];
  47.        $corre4 = $rowEmp['corre4'];        
  48.            
  49.           echo "<strong>".$rowEmp['pregunta1']."</strong><br>";
  50.           echo "<tr><td><input type='radio' name='Res1' value='1'>";
  51.           echo "".$rowEmp['1res1']."<br>";
  52.     echo "<input type='radio' name='Res1' value='2'>";
  53.           echo "".$rowEmp['1res2']."<br>"; 
  54.     echo "<input type='radio' name='Res1' value='3'>";
  55.           echo "".$rowEmp['1res3']."<br>"; 
  56.     echo "<input type='radio' name='Res1' value='4'>";
  57.           echo "".$rowEmp['1res4']."<br></td></tr>";   
  58. echo "</table><br>";
  59.  
  60.  
  61. echo "<table>";
  62.           echo "<strong>".$rowEmp['pregunta2']."</strong><br>";
  63.           echo "<tr><td><input type='radio' name='Res2' value='1'>";
  64.           echo "".$rowEmp['2res1']."<br>";
  65.     echo "<input type='radio' name='Res2' value='2'>";
  66.           echo "".$rowEmp['2res2']."<br>"; 
  67.     echo "<input type='radio' name='Res2' value='3'>";
  68.           echo "".$rowEmp['2res3']."<br>"; 
  69.     echo "<input type='radio' name='Res2' value='4'>";
  70.           echo "".$rowEmp['2res4']."<br></td></tr>";   
  71. echo "</table><br>";
  72. echo "<br>";
  73.  
  74.  
  75.  
  76. echo "<table>";
  77.           echo "<strong>".$rowEmp['pregunta3']."</strong><br>";
  78.           echo "<tr><td><input type='radio' name='Res3' value='1'>";
  79.           echo "".$rowEmp['3res1']."<br>";
  80.     echo "<input type='radio' name='Res3' value='2'>";
  81.           echo "".$rowEmp['3res2']."<br>"; 
  82.     echo "<input type='radio' name='Res3' value='3'>";
  83.           echo "".$rowEmp['3res3']."<br>"; 
  84.     echo "<input type='radio' name='Res3' value='4'>";
  85.           echo "".$rowEmp['3res4']."<br></td></tr>";   
  86. echo "</table><br>";
  87.        }
  88.     }
  89.  
  90. echo "<input type='image' src='images/nota.png' />";
  91. echo "</form>";  
  92.        }
  93.     }
  94.    }
  95.    }
  96. ?>
__________________
No hay Mayor señal de Ignoracia que creer imposible lo Inexplicable