Hi
i have one text box . in That text box i would like to print only numbers but not Alphabets . Please send the code in PHP . Urgent Help me please
How to print only numbers in txtbox?
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Please stop telling us your problems are urgent. Everyone's post is equally important here, and telling us yours is urgent will likely shy people away from helping you. Furthermore, we arn't here to give you solutions to your problems, this is a place of learning.
A simple preg_match() can capture all the numeric characters in a string using the \d (digit) character.
Thats as much help as you'll get from me until you can show that your at least trying.
A simple preg_match() can capture all the numeric characters in a string using the \d (digit) character.
Thats as much help as you'll get from me until you can show that your at least trying.
Code: Select all
$x = range(0,9); $i = str_split($q); $m = null; foreach ($i as $t => $o) if (in_array($o, $x)) $m .= $o;