Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

White space problem in HTML when pulling data from MYSQL DB with PHP

Status
Not open for further replies.

Screamsid

Programmer
May 14, 2003
20
GB
Hi,

I was wondering if anyone can help me in trying to solve this problem i'm having when i'm pulling data from a MYSQL database via the aid of PHP.

What is happening is when the data is pulled HTML stops displaying the rest of the string after the first white space.

For example if i pull the name Ben Kaye i only get Ben displayed in the HTML.

the code below is what i'm using at present with this problem.

echo(&quot;<td width=38%><input name=djname type=text id=djname size=35 value=$row_array[12]></td>&quot;);

If anyone can help asap they would be a star!!
 
What's happening is you need to quote the value, to make it work you can use either singles or doubles, to make it HTML standard compliant, it should be doubles. Of course so should all of your attributes... this is what I would suggest as the easiest modification...

Code:
echo '<td width=&quot;38%&quot;><input name=&quot;djname&quot; type=&quot;text&quot; id=&quot;djname&quot; size=&quot;35&quot; value=&quot;'.$row_array[12].'&quot;></td>';

Be certain to differentiate between the single and double quotes in that string, and notice after value= there is a double quote, followed by a single quote.... then the reverse after the $row_array variable.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top