Refael
asked on
numbers php and mysql
Hello Experts,
This is a php form with a mysql database.
One of the fields is a "security number".
The validation of the field entry is done as below:
Strange issue i have found out is: If the user enter for example the following numbers: "009"
it prints on the confirmation page the following sign "-" (as a result of the entry).
When i went back to the edit the entry (edit the form) the only number that displays in that field is number "9" so it basically trimmed the "00".
anyone has an idea why or how i can work around it?
This is a php form with a mysql database.
One of the fields is a "security number".
The validation of the field entry is done as below:
if(strlen($form_sec_number)<=4) $error_security=0;
Strange issue i have found out is: If the user enter for example the following numbers: "009"
it prints on the confirmation page the following sign "-" (as a result of the entry).
When i went back to the edit the entry (edit the form) the only number that displays in that field is number "9" so it basically trimmed the "00".
anyone has an idea why or how i can work around it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What is the desired length (in digits) of your security numbers? What data type does it go to in your database? What $error_security=0 mean or what does it do?
ASKER
Hi shinuq,
ok your first solution really helped me. i had also to change it from INT to String in the form script when inserting the data.... 'ssiisssssss' i guess you know what i mean,
thank you so much!
ASKER
You are right, it was INT and now i have changed it to: VARCHAR 11 UTF8_BIN.
Yet, still the same problem.
I tried to enter "009" directly via phpmyadmin and it went fine and also it prints on the page:"009".
BUT when i tired to update the entry (via the form) the same problem i face.
So i guess it is something in the form or?