# PHP field validation script

**URL:** <https://forum.kirupa.com/t/php-field-validation-script/253786>\
**Category:** programming\
**Created:** [March 5, 2008, 1:57am UTC](https://forum.kirupa.com/t/php-field-validation-script/253786 "2008-03-05T01:57:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pherank](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pherank](https://forum.kirupa.com/u/Pherank)\
**Post date:** [March 5, 2008, 1:57am UTC](https://forum.kirupa.com/t/php-field-validation-script/253786/1 "2008-03-05T01:57:33Z")

</div>

I need to submit a form field that allows for any 5 digit number (any order). The HTML input field code would look like this:

Reference Number: &nbsp;&nbsp;\<input type=“refnum” name=“refnum” class=“refnum”\>

There would need to be some PHP code that receives this data and validates it, then sends the user to a particular page if the field validates; otherwise, display a message. I think the basic PHP string statement would look something like this:

^[[:digit]]{5}$

I’m not a PHP programmer (I work with Actionscript), so I would appreciate some help with the PHP script.
