#!/usr/lib/php5/bin/php "; ?> Another PHP form example

Name: Enter a name that starts with an uppercase letter followed by one or more lowercase letters and with zero or more numbers at the end.


Description: Put any description here except nothing.
"; ?>


You have submitted this form "; $problem = array(); if ( !preg_match("/^[A-Z][a-z]+[0-9]*$/",$name) ) { $problem[] = "name"; } if ( !preg_match("/.+/",$desc) ) { $problem[] = "description"; } if (count($problem)==0) { echo "and the information is valid."; } else { echo "but the following fields need correcting:
"; foreach ($problem as $q) { echo "$q
"; } } } ?>