Page 1 of 1

Empty record display "empty" character

Posted: Fri Jan 21, 2005 9:49 am
by snicolas
Hi,

Running PHP and MSSQL.
In some table, my column isempty (NULL doesn't not appear but the cell is empty), let's say the column is called "data"
When I perform a SELECT and display the record of "data" on my page for the user to edit, the text input looks empty, but when I try to enter a new text, i notice that tere is already an "empty" character.
This is causing me problem, as user can edit this field or not if they want, but I perform a "number" check to allow only numbers for the field.
So if i try to save the form, even without modifyfing anything, the "error number" is triggerered as it can see that there is this empty character...
Any idea?

Sorry if it's not clear.

S

Posted: Fri Jan 21, 2005 10:04 am
by feyd
what character-code is this empty character?

Posted: Fri Jan 21, 2005 10:05 am
by snicolas
It seems to be empty..there is no chracter displayed actually.
When checking the source code of my file, I can see :
<input type="text" value=" ">
Note the space in value....


s

Posted: Fri Jan 21, 2005 10:08 am
by feyd
you can use trim() on the value before and after getting it from the user. This will remove whitespace characters around the string passed to it.

However, if that actually isn't a whitespace character, then you may need to specially filter it..

Posted: Fri Jan 21, 2005 10:19 am
by snicolas
I think trim() will work..thks feyd