I am trying to display a element from mysql table in a input box type=text. The data is a string value. But i can see only the first word of the entire string.
but if i echo the element, i get the full string value.
My code looks like this:
echo "Title: <input type=\"text\" name=\"title\" value=".$row['Title']."></input><br>";
Please let me know what am i doing wrong here.
Best Zeeshan
You haven't enclosed the text in quotes in the resulting HTML, try this:
echo "Title: <input type=\"text\" name=\"title\" value=\"".$row['Title']."\"></input><br>";
or better still
echo 'Title: <input type="text" name="title" value="'.$row['Title'].'"></input><br>';
which avoids having to escape the double quotes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With