
01/03/2007, 12:55
|
| | Fecha de Ingreso: febrero-2007 Ubicación: Peru
Mensajes: 38
Antigüedad: 18 años, 1 mes Puntos: 0 | |
Re: cual es la diferencia... hola, yo uso el siguiente codigo que encontre por ahi, espero que te sirva
<html>
<script language="javascript">
var nav4 = window.Event ? true : false;
function ValidarNombres(evento)
{
var key = nav4 ? evento.which : evento.keyCode;
return (key >= 97 && key <= 122)|| (key >= 65 && key <= 90) || (key >= 40 && key <= 57) || key == 40 || key == 41 || key == 95 || key == 32 || key == 37 || key == 241 || key == 209 || key == 38 || key == 35 || key == 64 ||key== 39|| key==46;
}
</script>
<body>
<form method="post">
<input type="text" value="<?=$catalogo ?>" size="40" name="catalogo" id="catalogo" onKeyPress="return ValidarNombres(event);" />
</form>
</body>
</html>
-------------------------------------------------------------------------
y en tu php <?
function unhtmlentities ($string) {
$trans_tbl =get_html_translation_table (HTML_ENTITIES );
$trans_tbl =array_flip ($trans_tbl );
return strtr ($string ,$trans_tbl );
}
$name=trim($_POST["catalogo"]);
$name=unhtmlentities($name); // este $name lo guardo en la base de datos y funciona
?>
Disculpa si es que esta medio entreverado, si no que lo tengo en funciones y he tendio que cortarlo para ponerlo en un solo documento, espero que te ayude |