Advertisement
Guest User

Form Validation

a guest
May 5th, 2012
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.51 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">          
  3.   <head>                  
  4.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />                  
  5.     <title>cuestionario                    
  6.     </title>                  
  7.    
  8.       <link type="text/css" rel="Stylesheet" href="js/jquery.validity.css" />
  9.         <script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
  10.         <script type="text/javascript" src="js/jquery.validity.min.js"></script>
  11.    
  12.    
  13.      <script type="text/javascript">
  14.             $(function() {
  15.                 $("form").validity(function() {
  16.                     $("#organizacion")
  17.                         .require();
  18.                 });
  19.             });
  20.         </script>
  21.  
  22.  
  23.   </head>
  24.  
  25.    
  26. <body>                      
  27.  
  28.  
  29.  
  30.  
  31.  <br>
  32.  
  33.  
  34.  
  35.  
  36.  
  37.    
  38. <div id="contenido_principal">
  39.  <?PHP
  40.  
  41.  
  42.  if ($_POST) {
  43.  
  44. $_TodoOK=1;
  45.  
  46. if ($_POST['organizacion']) {$_organizacion =   $_POST['organizacion'];} else {$_TodoOK=0;}
  47.  
  48. $_dirIP = $_SERVER [ 'REMOTE_ADDR' ];  
  49.  
  50. $sql = "INSERT INTO almacencuestionarios(FechaCumplimentacion  , Organizacion1 ,  IP)
  51.                        VALUES (NOW() ,  $_organizacion ,  '$_dirIP')";                        
  52.  
  53.  
  54. echo $sql ;
  55.                        
  56.  
  57.    
  58.    
  59.  } else {
  60.  
  61. ?>
  62.   <form  ACTION="" METHOD=POST>
  63.  
  64.  
  65.  
  66.   <table class="cuestionario" width="750" border="1" cellspacing="1">
  67.   <tr>
  68.     <th scope="col" width="650"></th>
  69.     <th scope="col">1</th>
  70.     <th scope="col">2</th>
  71.     <th scope="col">3</th>
  72.     <th scope="col">4</th>
  73.     </tr>
  74.   <tr>
  75.     <td><div align="right">Aquí pongo la pregunta</div></td>
  76.     <td><input type="radio" name="organizacion" value="1" id="organizacion" class="required" /></td>
  77.     <td><input type="radio" name="organizacion" value="2" id="organizacion" /></td>
  78.     <td><input type="radio" name="organizacion" value="3" id="organizacion" /></td>
  79.     <td><input type="radio" name="organizacion" value="4" id="organizacion" /></td>
  80.   </tr>
  81.  
  82.   </table><br>
  83.  
  84.           <INPUT TYPE="hidden" name="DireccionIP" value="
  85.         <?PHP
  86.             echo $_SERVER [ 'REMOTE_ADDR' ];
  87.         ?>">
  88.  
  89.         <input type='submit' value='Enviar datos' name='enviar' />  
  90.         <input name="reset" value="Borrar datos" type="reset">
  91.  
  92.  
  93. <?PHP
  94.             }
  95. ?>  
  96.  
  97. </div>                          
  98.          
  99.   </body>
  100. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement