Jump to content

!preg_match question?


PicnicTutorials

Recommended Posts

Hello, I'm stuck. I'm cleaning my email with this below. But I don't want it to run an error if the field is left blank. In other words, I want to clean it "if" stuff is input, but I also want it to send if there is nothing input. Currently it won't send the form if no input. How to edit? Thanks!

 

// Clean Email

if (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i",$email)) {

header( "Location: $errorurl" );

exit ;

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...