print only to space

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
jfigueiredo
Forum Newbie
Posts: 5
Joined: Tue Jul 12, 2005 9:57 am

print only to space

Post by jfigueiredo »

Hi ,

Need some help

I get data from postgre, but when i passed to text it cuts to space the code is:
echo "<tr><td><font szie=2>First name:</td><td><input type=text name=Fname value=" . $row['Fname'] . "></td></tr>";

tre result if Fname ='Peter David' is 'Peter', dont show anything after the space

Thanks in advance
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Change your echo to

Code: Select all

echo '<tr><td><font szie=2>First name:</td><td><input type=text name=Fname value="'.$row['Fname'].'"></td></tr>';
Your echo is outputing to the browser as HTML like this

Code: Select all

&lt;input type=text name=Fname value=Peter David&gt;
when it should be :

Code: Select all

&lt;input type=text name=Fname value=&quote;Peter David&quote;&gt;
The value has to come within quotes ("") to accept blanks.
jfigueiredo
Forum Newbie
Posts: 5
Joined: Tue Jul 12, 2005 9:57 am

Post by jfigueiredo »

That's rigth, works fine

Thanks
Post Reply