Skip to content Skip to sidebar Skip to footer

Restricting Characters to Numbers Only in Forms (PHP)

PHP logo

Limit characters to only number only or Big alphabet Yet Small alphabets very simple, just need a little php code.

This time I am going to share how to use the function Eregi this simple one. And if you use the form, you can of course also use the help function if so that you can be notified easily.

Someone may have had trouble limiting characters to numbers only. But on Google which I know uses Javascript, it’s easier and easier if I share this!

As per the title of this post, the target’s position is enabled shape. So we’re going to do a little test form, not an engineer, just an experiment.
Check out the code below first!

Berhasil Masuk';}else{echo '
Masukan ID:

';}?>

Explanation!

When eat To view notification of a successful or unsuccessful entry on the listed POST form.

When eregi limit to numbers only.

shape used as a character writing system, from the column to the submit button.

Also if you want to add 2 EREGI functions to an if. Must use function or like || . Not much different, just like that!

One thing is missing, namely to limit only upper or lower alphabets. You can change the code like [0-9] be so.

Subsidiary alphabets: [a-z]
Large alphabets: [A-Z]
Upper and lowercase letter: [A-Z-a-z]

And so on, you just have to edit like the code above. I think this method is very simple. Because it only uses one function, not several.

Eregi is shared with many functions, you can see them all on the original PHP site HERE.

Is anyone else confused ..? Please comment.

Hopefully useful and good luck