Jump to content

stripping all but numbers


kingb00zer

Recommended Posts

Hi I am attempting to strip the letters from certain input boxes within my website and seem to have a hard time understanding how preg_replace works. Here is the code I have;

$x= $_POST['inputdata'];$y= preg_replace("[^0-9]", "", $x);

The letters wont strip from the input box and I cant work out why.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...