mtgriffiths Posted March 6, 2008 Share Posted March 6, 2008 Hi All, I am trying to display the information from a query into a text box so that i can create an update function. The code i am using is: $Query = mysql_query("SELECT * FROM team_details WHERE Team_Name = '$Team'") or die(mysql_error()); while($row = mysql_fetch_assoc($Query)){ <input type='text' name='Team_ID' value=<?php echo $row['Captain']; ?>> The problem i am getting is that the value will display Matthew but inside the database the value that should be pulled is Matthew Griffiths. The second word is being cut off Is there any way of stopping this? Thanks in advance Matthew Quote Link to comment Share on other sites More sharing options...
mainewoods Posted March 6, 2008 Share Posted March 6, 2008 while($row = mysql_fetch_assoc($Query)){ <input type='text' name='Team_ID' value=<?php echo $row['Captain']; ?>> if the 'value=' clause has a value that has a space in it, it has to be surrounded by quotes. As well if the loop executes more than once, you will have multiple form fields with the same name, 'TEAM_ID' and you should not do that. <input type='text' name='Team_ID' value="<?php echo $row['Captain']; ?>"> Quote Link to comment 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.