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
waradmin
Forum Contributor
Posts: 240 Joined: Fri Nov 04, 2005 2:57 pm
Post
by waradmin » Sun Oct 22, 2006 9:15 pm
I am trying to display a row from a database as the value of a text box, but it is cutting it off at the first space.
For example the database row will be: University of Minnesota Duluth but it will only display University in the text box. Any way to fix this to display everything and not stop after a space?
Cameri
Forum Commoner
Posts: 87 Joined: Tue Apr 12, 2005 4:12 pm
Location: Santo Domingo, Dominican Republic
Post
by Cameri » Sun Oct 22, 2006 9:26 pm
First, check if in the db the string is complete.
Secondly, I'll be glad to help you if you showed the part of your code where the problem is.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sun Oct 22, 2006 10:54 pm
sounds like you forgot quotes around the value attribute
waradmin
Forum Contributor
Posts: 240 Joined: Fri Nov 04, 2005 2:57 pm
Post
by waradmin » Mon Oct 23, 2006 8:00 am
Code: Select all
echo "<tr><td><div align=right>College:</div></td><td><input type=text name=college value=" . $row['college'] . "><input type=text name=hsyear maxlength=4 size=4 value=" . $row['college_grad_year'] . "></td></tr>";
Where $row['college'] is stored in the database as TEXT: University of Minnesota Duluth
Cuts it off at University, but when just echoing the row it will output the whole thing.
Mordred
DevNet Resident
Posts: 1579 Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria
Post
by Mordred » Mon Oct 23, 2006 8:06 am
As Jcart said, you forgot putting quotes. Those quotes are in the PHP source, there are no quotes in the HTML. View source of the result page.
Rovas
Forum Contributor
Posts: 272 Joined: Mon Aug 21, 2006 7:09 am
Location: Romania
Post
by Rovas » Mon Oct 23, 2006 8:07 am
waradmin
Forum Contributor
Posts: 240 Joined: Fri Nov 04, 2005 2:57 pm
Post
by waradmin » Mon Oct 23, 2006 8:24 am
sorry about that, I didnt even realize I forgot \" on the value, bah.