Php question: why it shows not the whole string from DB?

Willbor

New member
This string works fine:
echo "<tr><td>" . $row['Name'] . "</td> ........
// It displays John Doe - OK.

This string doesn't work fine:
echo "<tr><td><input type=\"text\" name=\"ShopName\" value=" .$row['Name']. " size=\"90\" maxlength=\"200\" /></td>
//It displays only John, but not John Doe - not OK.

It happens at the same page. I don't make any changes of table. Increasing size size=\"90\" didn't help. What's the problem?

P.S. Field "Name" has type varchar(200).
Thank you.
 
echo "... value=" . $row['Name'] . " ...</td>"

When this executes it returns as html code literally:

value=John Dee ...

You need " quotes " around it else john is interpreted as the value and dee is interpreted as some unknown tag.

So change
" ... value=" . $row['Name'] . "... </td>"
to
"... value=\"" . $row['Name'] . "\" ... </td>"
 
Back
Top