bzptlx Posted October 2, 2007 Share Posted October 2, 2007 I'm new here and if this has been asked and solved before I am sorry for the dupe. I am using PHP 5.2.4 with Apache 2 and MySql 5.0.45. I am having a problem displaying data in an HTML for for updates. The data is truncated at the first space in the form field. For instance "The Beer Store" is displayed as "The". If I display the data outside the form field (input type-text) it displays correctly so I know the pull from the database is working correctly. Any ideas? TIA Quote Link to comment https://forums.phpfreaks.com/topic/71532-solved-problem-with-html-form/ Share on other sites More sharing options...
adam291086 Posted October 2, 2007 Share Posted October 2, 2007 Post the code so we can see whats going on Quote Link to comment https://forums.phpfreaks.com/topic/71532-solved-problem-with-html-form/#findComment-360132 Share on other sites More sharing options...
bzptlx Posted October 2, 2007 Author Share Posted October 2, 2007 Here is the code section. The one highlighted in green works properly but the one in red stops sidplay after the first space: $query = "SELECT * FROM location where idnum='1'"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<form>"; echo "<tr border=0>"; echo "<td border=0>"; echo "<div class=btxt>Name: "; echo "<input type=text size=50 value={$row['name']}>{$row['name']}</div>"; echo "</td>"; echo "</tr>"; ....... Quote Link to comment https://forums.phpfreaks.com/topic/71532-solved-problem-with-html-form/#findComment-360138 Share on other sites More sharing options...
MmmVomit Posted October 2, 2007 Share Posted October 2, 2007 Put quotes around the value of every parameter. echo "<input type=text size=50 value={$row['name']}>{$row['name']}</div>"; Is going to evaluate to <input type=text size=50 value=The Beer Store>The Beer Store</div> The browser is going to interpret this as an input tag with the value attribute set to The and two additional unknown attributes Beer and Store. Change all your tags so they look like this. echo "<input type=\"text\" size=\"50\" value=\"{$row['name']}\">{$row['name']}</div>"; This way value will be set to The Beer Store instead of The. Quote Link to comment https://forums.phpfreaks.com/topic/71532-solved-problem-with-html-form/#findComment-360148 Share on other sites More sharing options...
bzptlx Posted October 2, 2007 Author Share Posted October 2, 2007 That did it. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/71532-solved-problem-with-html-form/#findComment-360152 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.