Forum Moderators: coopster

Message Too Old, No Replies

input type="text" cuts off any value at the first space

         

Neoguardian

10:19 pm on Oct 26, 2006 (gmt 0)

10+ Year Member



Hey,

I'm creating a site that allows users to store and update profiles. On the "Modify Profile" screen, I display the text from various parts of the profile in their respective sections, so the user can edit it and just hit submit.

The problem is this: Some inputs use <input type="text">, such as the user's name, trade and location. When a user registers, for example, they'll say "New York" as their location and it will be stored that way in the database. However, when they bring up the modify profile screen and I try to display their location like this:

<input name="Alocation" type="text" value='.stripslashes($row2["location"]).'>

It only displays "New"

yet if I try to display it like this:

<textarea name="Alocation" rows="5" cols="60">'.stripslashes($row2["location"]).'</textarea>

The entire "New York" will display.

Can someone tell me why this happens, and if there's a way to fix this problem with <input type="text">? I'd rather not use <textarea> for small items if I don't have to, since it looks ugly.

-Michael

Steerpike

10:40 pm on Oct 26, 2006 (gmt 0)

10+ Year Member



Use this:
<input name="Alocation" type="text" value='".stripslashes($row2["location"])."'>

Neoguardian

11:18 pm on Oct 26, 2006 (gmt 0)

10+ Year Member



> Use this:
><input name="Alocation" type="text" >value='".stripslashes($row2["location"])."'>

That didn't work -- I got a parse error. Also remember I've got an echo before the statement, encasing it in single quotes.

Neoguardian

11:25 pm on Oct 26, 2006 (gmt 0)

10+ Year Member



Actually, Steerpike, it works now. I think you meant to say "'.stripslashes($row2["location"]).'" with the double quotes on the outside.

Thanks!

-Michael