Jump to content

Validation


shan_cool

Recommended Posts

Hi all,

The defect id which i store in the MYSQL is 1,2,3 and so on....In my front end(PHP) it shld be displayed as 00001,00002,and so on,I made it displayed using Lpad in my select queries.
In one of my screen,when i enter the defect id,certain set of records shld be displayed and it wrks fine.
Now the pblm is when i enter the defect id as 1,the query is excuted which is obvious....
Now i need a validation to be carried out which checks for first 4 zeros of the number and then allows the user to get the query excuted.

Can anybody help me,
Thanks in advance,
Shan
Link to comment
https://forums.phpfreaks.com/topic/3371-validation/
Share on other sites

  • 4 weeks later...
regular expressions should be your best friend..

var emailRegex = new RegExp("^0{4}.{1}$");
var emailText = '00003';
if(emailRegex.test(emailText)){
document.write("number has 4 zeroes and a positive integer.");
}else{
document.write("not today, better make this function return true.");
}

this should match 4 zeroes than a non-zero integer, i'm sure this must have to be altered.
Link to comment
https://forums.phpfreaks.com/topic/3371-validation/#findComment-16071
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.