Ad block is installed and active. Please support us by disabling it.
HomeSunday, November 19, 2017, 13:50:24
2

Preg_Match - PHP Form Validation

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

PHP Form Validation

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

PHP DateTimeZone

PHP representation of time zone

Jquery PHP Contact Form

This script allows your visitors to send you an email directly from your website.

Smarty - Create dynamic Web Pages with PHP & MySQL

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

php Array

These functions allow you to interact with and manipulate arrays in various ways. Arrays are essential for storing, managing, and operating on sets of variables.

Show / Hide Div with CSS

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

Timed Redirect JavaScript

Timed redirect javaScript/PHP example

Link Base 1.1. - Free PHP Link Index Script

Manage your links using a MySQL database. Features easy install, user submission, and an admin panel to add, edit and remove categories and links.

View content in a zip file with PHP

List all files in a zip archive with PHP
About Author

cilipe

Date Registered: Mon, Feb 16, 15
Last Time Online: Wed, Feb 18, 15
So far has created 2 entries.
cilipe
This author has not yet filled in any details.