Ad block is installed and active. Please support us by disabling it.
HomeThursday, September 21, 2017, 03:21:02
2

Preg_Match - PHP Form Validation

Tuesday, February 10, 15, 01:10:37, 3 Yaers Ago Via wain, Hits: 2666
PHP form validation with preg_match
Download source code:
http://phpform.net/download.php?f=pregmatch.zip

index.php

Code:
<?php
if(isset($_POST['submit']))
{
$textvalue = $_POST['textvalue'];
if(preg_match('#[^A-Za-z0-9]#', $textvalue)){
echo "<center><font style=\"font-family:tahoma;\">..letters and numbers only:
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (strlen($textvalue) < 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($textvalue) > 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="textvalue" 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

Link Base L.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.

PHP getdate

Returns an associative array containing the date information of the timestamp, or the current local time if no timestamp is given.

Bookmark Script

Allow your users to easily bookmark your site, by clicking on a link on the page.

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.

Upload and Resize an Image with PHP

Tutorial - How to upload and resize image with PHP

PHP Cookies and Sessions Tutorial

PHP Cookies and Sessions Tutorials

Upload Attachment - PHP Tutorial

Upload attachment with PHP example, Requirement(s): PHP server

Upload Image With PHP

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

Smarty Paginate Example - Smarty Pagination with PHP

Smarty Paginate Example, Smarty Pagination with PHP. SmartyPaginate: a class/plugin for data set pagination within the Smarty template environment

Convert pdf to image - mpdf

Convert pdf file to jpg with php and mpdf
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.