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
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>";
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.