Missing Zeros when posting html form data
Posted: Mon Feb 26, 2007 6:50 am
Hi
Usually when I have a problem coding it lasts for a few hours or until I find a fix somewhere on the net but I have been stuck on this problem for about 2 days and I cannot find anything relavent on the internet.
When I submit a form (form.php) to a processing page (add.php) any text with more than one zero at the end of the string, has the zeros eliminated. The main text box that I am using will take a number but this also happens in a textbox that I want to take text only [a-z0-9]
e.g.
text field = 1 => output after post = 1
text field = 10 => output after post = 10
text field = 100 => output after post = 1
text field = t10 => output after post = t10
text field = t100 => output after post = t1
text field = t100t => output after post = t100t
text field = 220.00 => output 22
text field = 220.02 => output 220.02
As you can see the problem occurs if the last characters of the textbox are 00 and the program will remove all trailing zeros from the string. The same problem occurs if the form type='number'.
I have ran loads of tests to establish if there is an error in my code but it happens as soon as aVar[$i]=$_POST['aTextbox']; is executed
the value of aVar[$i] is as shown on the ouput details above
I can paste in some of the code if you like but from what I can tell, it's a general problem
Apologies if this is a silly question and i'm missing something basic.
Thanks
Tim
Usually when I have a problem coding it lasts for a few hours or until I find a fix somewhere on the net but I have been stuck on this problem for about 2 days and I cannot find anything relavent on the internet.
When I submit a form (form.php) to a processing page (add.php) any text with more than one zero at the end of the string, has the zeros eliminated. The main text box that I am using will take a number but this also happens in a textbox that I want to take text only [a-z0-9]
e.g.
text field = 1 => output after post = 1
text field = 10 => output after post = 10
text field = 100 => output after post = 1
text field = t10 => output after post = t10
text field = t100 => output after post = t1
text field = t100t => output after post = t100t
text field = 220.00 => output 22
text field = 220.02 => output 220.02
As you can see the problem occurs if the last characters of the textbox are 00 and the program will remove all trailing zeros from the string. The same problem occurs if the form type='number'.
I have ran loads of tests to establish if there is an error in my code but it happens as soon as aVar[$i]=$_POST['aTextbox']; is executed
the value of aVar[$i] is as shown on the ouput details above
I can paste in some of the code if you like but from what I can tell, it's a general problem
Apologies if this is a silly question and i'm missing something basic.
Thanks
Tim