Form field & spaces

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
vfm
Forum Commoner
Posts: 32
Joined: Tue Mar 30, 2010 10:47 pm

Form field & spaces

Post by vfm »

Hi,

I'm not sure if this is a php issue or an sql one. I have a field 'color' and when I put in say "Navy blue" and output that into a input field I only get "Navy". Can anyone help explain to me why this is happening and what I need to do to get around it?

Thanks in advance.

vfm.
Blackveiled
Forum Newbie
Posts: 2
Joined: Thu Nov 04, 2010 3:07 am

Re: Form field & spaces

Post by Blackveiled »

Try making sure the field value in your database where "Navy blue" is found is "varchar" type. Otherwise, you should explain with more detail. It's probably an SQL problem.
vfm
Forum Commoner
Posts: 32
Joined: Tue Mar 30, 2010 10:47 pm

Re: Form field & spaces

Post by vfm »

Hi,

It doesn't actually look like it's an SQL problem. When I submit a value and look at the database I see the full string. However, when I use this:

<input type="text" name="colour" id="colour" size="50" value=<?= $row['colour'] ?>>

I see "Navy". Does it have something to do with the way I'm calling it?

Cheers,
vfm.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: Form field & spaces

Post by s.dot »

Your value attribute needs to be in quotes in the HTML.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Blackveiled
Forum Newbie
Posts: 2
Joined: Thu Nov 04, 2010 3:07 am

Re: Form field & spaces

Post by Blackveiled »

s.dot wrote:Your value attribute needs to be in quotes in the HTML.
This.
Post Reply