Krayis
03-28-2005, 07:02 PM
I have a form and I got a question. I have a place where users type their email. Anyone I can make it so that there has to be a @ sign?
Thanks.
Thanks.
![]() | View Full Version : PHP Forms Help. Krayis 03-28-2005, 07:02 PM I have a form and I got a question. I have a place where users type their email. Anyone I can make it so that there has to be a @ sign? Thanks. foress 03-29-2005, 02:12 PM Two Text box? [ textbox1] @ [textbox2] ? But I don't think you users mind to type the @ sign. mfonda 03-29-2005, 09:44 PM assume $email is the email posted to the form. if (preg_match('/^[A-z0-9_\-]+\@([A-z0-9_-]+\.)+[A-z]{2,4}$/',$email)) { //email is a valid email } else { //email is invalid } Ivan-Funio 04-06-2005, 10:04 PM I would use javacript to check if the mail is correct. this is an easy way to check it. I hope you can use it. I don't recommend to use PHP because the validation use time in the server, it's better just send validate datas. function mail(){ if( Form.mail.value.indexOf('@')==-1){ alert("An error in your mail"); return (false); } return true; } "All you need is a dream and Funio (http://www.funio.com) to host it" :mxflag:Ivan Fuentes:caflag: Technical Support www.funio.com |