Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsWeb Design & DevelopmentGeneral Web Design Discussion right
  Closed Topic Start new topic
left right
craig2u
post Sep 30 2009, 08:45 PM
Post #1


Newbie
*

Group: Members
Posts: 2
Joined: 30-September 09
Member No.: 112,112



Sometime my visitors mistype their email address. I want to verify it so their message is not delivered until the email field is ok. Something like checking for @ character, etc.
Go to the top of the page 
 
  + Quote Post
Stryker
post Oct 1 2009, 05:48 AM
Post #2


Newbie
*

Group: Members
Posts: 1
Joined: 1-October 09
Member No.: 112,166



You can use another error output method but that generally works for me.

CODE
$errors = array();
$regex = "/^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+.[a-z]{2,}$/i";
if(!preg_match($regex, $email_field))
{
  $errors[] = "E-mail is not in correct format!<br />";
}
Go to the top of the page 
 
  + Quote Post
Ed
post Oct 1 2009, 11:10 AM
Post #3


Outrageously Uber Ninja
*******

Group: Administrators
Posts: 2,831
Joined: 11-March 07
From: UK
Member No.: 9



PHP5 comes with a fantastic little filter library:

CODE
if(filter_var($email, FILTER_VALIDATE_EMAIL))
{
    // Email format is correct
}


If you're not on Zymic hosting you can extend the check to start a smtp session with the domain's mail exchange servers and check the email address actually exists. This method isn't full proof if someone sets their MX records to point to a mailserver which has been setup as a relay.

Email verification is the best method to ensure the mailbox actually exists.
Go to the top of the page 
 
  + Quote Post
craig2u
post Oct 2 2009, 09:35 AM
Post #4


Newbie
*

Group: Members
Posts: 2
Joined: 30-September 09
Member No.: 112,112



QUOTE(Ed @ Oct 1 2009, 11:10 AM) *
PHP5 comes with a fantastic little filter library:

CODE
if(filter_var($email, FILTER_VALIDATE_EMAIL))
{
    // Email format is correct
}


If you're not on Zymic hosting you can extend the check to start a smtp session with the domain's mail exchange servers and check the email address actually exists. This method isn't full proof if someone sets their MX records to point to a mailserver which has been setup as a relay.

Email verification is the best method to ensure the mailbox actually exists.

To my surprise, my free hosting service does not have PHP5 , or even worst, any version of PHP. So my only solution is to use a remotely hosted form service, like http://www.123contactform.com or http://www.kontactr.com
Go to the top of the page 
 
  + Quote Post
Ed
post Oct 2 2009, 10:28 AM
Post #5


Outrageously Uber Ninja
*******

Group: Administrators
Posts: 2,831
Joined: 11-March 07
From: UK
Member No.: 9



QUOTE(craig2u @ Oct 2 2009, 10:35 AM) *
To my surprise, my free hosting service does not have PHP5 , or even worst, any version of PHP. So my only solution is to use a remotely hosted form service, like http://www.123contactform.com or http://www.kontactr.com


Zymic's free hosting offers php5; However we don't provide outgoing connections so SMTP checks can't be performed, filter exists however and mail() can be enabled for a one off $10 charge.
Go to the top of the page 
 
  + Quote Post
cashloan
post Sep 29 2011, 07:00 AM
Post #6


Member
**

Group: Members
Posts: 30
Joined: 26-September 11
Member No.: 210,615



Very strange request in an art forum from a first time poster. BUT, in the interest of answering the question:

Attach an onClick event to your submit button, so that it doesn't submit the form until a predetermined function has processed. The function should be written in Javascript.

To show you how easy such a task is, I Googled "javascript validate email", and the very first result was this site: http://www.codetoad.com/javascript/is_valid_email.asp

That should do what you need, magical robot...and it doesn't cost a dime.
Go to the top of the page 
 
  + Quote Post
 Closed Topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 26th May 2013 - 06:41 AM