Ver Mensaje Individual
  #4 (permalink)  
Antiguo 04/05/2015, 07:52
el__tamer
 
Fecha de Ingreso: diciembre-2013
Mensajes: 81
Antigüedad: 10 años, 4 meses
Puntos: 1
Respuesta: validar varios correo en un input

Código PHP:
Ver original
  1. <?php
  2. require("../../../conf/_config.php");
  3. $datos = mysql_fetch_array(sel_usuarios("*","WHERE usua.USU_ID = $_POST[id]"));
  4. ?>  
  5. <div id="titulo_dentro">Editar Usuario</div>
  6. <table class="tablesorter">
  7.     <tbody>
  8.         <tr>
  9.             <td colspan="2" class="infor">Los campos con un aster&iacute;sco (*) son obligatorios.<br />
  10.             <strong>(*) Dejar en blanco el campo contrase&ntilde;a si no desea modificarla</strong></td>
  11.         </tr>
  12.         <input type="hidden" class="campos" name="modo" value="editar">
  13.         <input type="hidden" class="campos" name="id" value="<?php echo $_POST['id']; ?>">
  14.         <input type="hidden" class="campos" id="pagina" name="pagina" value="list_usuarios.php">  
  15.         <tr>
  16.             <th align="right">Empresa(*)</th>  
  17.             <td><select class="campos" type="text" name="empresa" id="empresa" onchange="javascript:chg_locales(this.value,'');">
  18.             <option value=""></option><?php $res = sel_empresas("*"," ORDER BY empr.EMP_NOMBRE asc");
  19.             while($row = mysql_fetch_array($res)){
  20.                 ?><option value="<?php echo $row["EMP_ID"]; ?>" <?php if($row["EMP_ID"] == $datos["USU_EMP_ID"]){ echo "selected"; }
  21.                 ?>><?php echo _t($row["EMP_NOMBRE"]); ?></option>
  22.                 <?php }
  23.             ?>
  24.             </select></td>
  25.         </tr>
  26.         <tr>
  27.             <th align="right" width="120">Nombre(*)</th>
  28.             <td><input type="text" name="nombre" size="70" value="<?php echo htmlentities($datos['USU_NOMBRE']); ?>" class="campos" id="nombre"></td>
  29.         </tr>  
  30.         <tr>
  31.             <th align="right">Nick(*)</th>
  32.             <td><input type="text" name="nick" size="70" value="<?php echo htmlentities($datos['USU_NICK']); ?>" class="campos" id="nick"></td>
  33.         </tr>  
  34.         <tr>
  35.             <th align="right">Contrase&ntilde;a</th>
  36.             <td><input class="campos" type="password" name="pass" value="" id="pass" size="60"></td>
  37.         </tr>
  38.         <tr>
  39.             <th align="right">E-mail(*)</th>  
  40.             <td><input class="campos" type="text" name="email" value="<?php echo htmlentities($datos['USU_MAIL']); ?>" id="email" size="60"></td>
  41.         </tr>
  42.         <tr>
  43.             <th align="right">Operaciones</th>  
  44.             <td>         
  45.             <?php
  46.             $operaciones = explode(",",$datos["USU_OPERACIONES"]);
  47.             $res = sel_operaciones("*"," ORDER BY OPE_NOMBRE asc","","");
  48.             while($row = mysql_fetch_array($res)){
  49.                 ?>
  50.                 <input type="checkbox" name="operacion[]" value="<?php echo $row["OPE_ID"]; ?>" class="campos" <?php
  51.                 if(in_array($row["OPE_ID"],$operaciones)){ echo "checked"; }
  52.                 ?>> <?php echo _t($row["OPE_NOMBRE"]); ?><br>
  53.                 <?php }
  54.             ?>  
  55.             </td>
  56.         </tr>  
  57.         <tr>
  58.             <th align="right">Pertenece</th>
  59.             <td id="userlocales"><?php $locales = explode(",",$datos["USU_LOCALES"]);
  60.             $result = sel_locales("loca.LOC_ID,loca.LOC_NOMBRE", "where empr.EMP_ID='$datos[USU_EMP_ID]'");
  61.             if(mysql_num_rows($result) > 0){
  62.                 while($row=  mysql_fetch_array($result)){
  63.                     ?>
  64.                     <input type="checkbox" name="local[]" value="<?php echo $row["LOC_ID"]; ?>" class="campos" <?php if(in_array($row["LOC_ID"],$locales)){ echo "checked"; } ?>> <?php
  65.                     echo _t($row["LOC_NOMBRE"]); ?><br>
  66.                     <?php }
  67.             }
  68.             ?></td>
  69.         </tr>
  70.     </tbody>
  71. </table>    
  72. </div>
  73. <a class="button" onClick="return direccionEmail(email,'email' )" href="javascript:guardar('empresa,nick,email','usuario');"><span><div class="save">Grabar</div></span></a><a class="button" href="javascript:listar();"><span><div class="delete">Cancelar</div></span></a>
  74.  
  75. <script languaje="JavaScript">
  76. function direccionEmail(theElement, nombre_del_elemento )
  77. {
  78. var evaluar = theElement.value;
  79. var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
  80. if (evaluar.length == 0 ) return true;
  81. if (filter.test(evaluar))
  82. return true;
  83. else
  84. alert("El formato E-mail es incorrecto");
  85. theElement.focus();
  86. return false;
  87. }
  88. </script>

Con un correo queda bien la validacion, pero no puedo implementar el split