i have ID numbers that i want to enter it into my database using filling form by user. so i need to validate this number format. number format should be like this. first 9 numbers and after nine numbers it must have a letter V. (123456789V) i need to validate this number format when entering to form. i use array and chk the array for number format. bt its too long coding format.. anyone can give me a short code.please any one can help mee..
Kadafiz
0
Light Poster
Recommended Answers
Jump to PostHi Kadafiz. Try this idea.
1. You can restrict the "userID text box" to make it accept only integers (0-9) using javascript. here's the code.
<HTML> <HEAD> <SCRIPT language=Javascript> function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode …
Jump to PostYou could manipulate string to see if it contains letter 'V' at 10th position (9th if you consider that the string starts with index 0, 1... and so on). One way to achieve your goal is,
$num = "123456789V"; if(strlen($num) == 10){ echo "OK. length is OK."; …
All 6 Replies
lyrico
23
Junior Poster in Training
Kadafiz
0
Light Poster
kekkaishi
18
Junior Poster
lyrico
23
Junior Poster in Training
lyrico
23
Junior Poster in Training
lyrico
23
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.