Jump to content

i cannot rectify this


Pawan_Agarwal

Recommended Posts

I want to know question related to php and database

 

If I fetch information from database, I get "Steve Jobs" if I print the name in html page

 

         echo "<td width=50% align=center>".$row['NAME']."</td></tr>";

 

BUT If I fetch information from database, I get only "Steve" if I put the name in text field or text box

 

         echo "<td width=50% align=center><input type='text' size=50 value=".$row['NAME']."></td></tr>";

 

 

 

Can any one help me ?????

Link to comment
https://forums.phpfreaks.com/topic/285860-i-cannot-rectify-this/
Share on other sites

Your problem has nothing to do with PHP or the database - it is an HTML error. You are not putting the values of the HTML parameters in quotes. If a parameter value has no spaces in it this will work, but is still a bad idea. But, in this case the value of the 'value' parameter has a space in it. So, when the user's browser is reading the code it assumes the space is the end of the value.

 

The result of the code you have will be something like:

 

<td width=50% align=center><input type='text' size=50 value=steve jobs></td></tr>

 

What you want is

 

<td width='50%' align='center'><input type='text' size='50' value='steve jobs'></td></tr>

 

Change the code to

 

echo "<td width='50%' align='center'><input type='text' size='50' value='".$row['NAME']."'></td></tr>";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.