Ad block is installed and active. Please support us by disabling it.
HomeWednesday, April 25, 2018, 08:53:18
2

Preg_Match - PHP Email Validation

Tuesday, February 10, 15, 01:07:52, 3 Yaers Ago Via wain, Hits: 5860
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

PHP Mail

Sends an email.

PHP filesize

The filesize function returns the size of the specified file.

Adsense crawler errors and robots.txt

How to fix Google AdSense crawler errors in robots.txt

Convert pdf to image - mpdf

Convert pdf file to jpg with php and mpdf

Advanced Contact Form - PHP Script

Advanced Contact Form with email and form field validation. Features: HTML Output(Response), Captcha Image.

HTML Button Generator

This script will allow your visitors to create HTML Buttons online. To use the "html button generator" script completely free , the "powered by" link at the bottom of the pages must stay intact.

Contact Us 2.0. :: PHP Form

Version 2.0. - A contact us form with email and form field validation. It allows your visitors to send you an email directly from your website.

Process Form Data with Jquery

jQuery, Process form data

Upload Image with PHP [Example2]

[Example2] Tutorial - How to upload and resize image with PHP

Preventing multiple form submissions

Preventing multiple form submissions
About Author

wain

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