HomeSaturday, August 18, 2018, 20:18:44
2

Preg_Match - PHP Email Validation

Tuesday, February 10, 15, 01:07:52, 4 Yaers Ago Via wain, Hits: 6479
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 Form Validation

PHP form validation :: PHP tutorial, requirement(s): PHP Server

PHPBB3 Shoutbox

Vesion: 1.1. Released: 08/08/10, Licence GNU, Price: Free

PHP Redirect

Header (location) redirect must be processed before any output to the browser.

Show / Hide Div with CSS

CSS Display and Visibility:The visibility property specifies whether or not an element is visible.

Upload Image With PHP

[Example3] Tutorial - How to upload image in php.

Advanced Contact Form - PHP Script

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

PHP $_SESSION

Session_start creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.

Images In Textarea - CSS

Tutorial Images in Textarea

Smarty - Create dynamic Web Pages with PHP & MySQL

Creating Dynamic Web Pages Using Smarty and MySQL - Requirement(s): PHP Server, MySQL

Sitemap

phpForm.net Website Sitemap
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.