Empty record display "empty" character

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

Empty record display "empty" character

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what character-code is this empty character?
snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

Post by snicolas »

I think trim() will work..thks feyd
Post Reply