Ad block is installed and active. Please support us by disabling it.
HomeSunday, November 19, 2017, 14:08:33
2

Preg_Match - PHP Email Validation

Tuesday, February 10, 15, 01:07:52, 3 Yaers Ago Via wain, Hits: 2979
Validate email with preg_match in php
Download source code:
http://phpform.net/download.php?f=pregmatch_mail.zip

index.php

Code:
<?php
if(isset($_POST['submit']))
{
$emailvalue = $_POST['emailvalue'];
if (!preg_match("/([A-Z0-9_-]+\@[A-Z0-9_-]+\.[a-z.]{2,7}+)+$/i",$emailvalue)){
echo "<center><font style=\"font-family:tahoma;\">..invalid email address:
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (strlen($emailvalue) < 4) {
echo "<center><font style=\"font-family:tahoma;\">..at least 4 characters long:
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (strlen($emailvalue) > 40) {
echo "<center><font style=\"font-family:tahoma;\">..max characters: 40
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
echo "<center><font style=\"font-family:tahoma;\">OK.";
}else{
?>
<form method="post" action="index.php">
<table>
<tr>
<td>
Text:
</td>
<td>
<input name="emailvalue" size="60" maxlength="255">
</td>
</tr>
</table>
<table>
<tr>
<td>
<input type="submit" name="submit" value="submit">
</td>
</tr>
</table>
</form>
<?php } ?>

Sign In

Sponsor

Related

Stack Overflow Clone Script - Ja2BU

Open source question and answer script written in PHP, MySQL and jQuery. Main features are: SEO friendly url's, private message system, rating system, comments system.

PHP Write to File

PHP Write to File :: PHP Tutorial, requirement(s): PHP server

PHP Cookies - setcookie

Defines a cookie to be sent along with the rest of the HTTP headers.

Preventing multiple form submissions

Preventing multiple form submissions

Filter Words in PHP - PHP Tutorial

Filter bad words in PHP, requirement(s): PHP server

Email Link

HTML email link example

PHP str_replace

str_replace - This function returns a string or an array with all occurrences of search in subject replaced with the given replace value

How to check checkbox checked

Checking if checkbox is checked with jQuery

PHP Links Script 1.1.

This script allows you to manage your links using a MySQL database. It features easy install, user submission, and an admin panel to add, edit and remove categories and links. The script is easy to customize to suit your needs.

Email to Friend - PHP Script

This form allows your visitors to suggest your site to a friend. It features an HTML email format and an admin notification email.
About Author

wain

Date Registered: Sun, Feb 8, 15
Last Time Online: Thu, Jun 15, 17
So far has created 115 entries.
wain
This author has not yet filled in any details.