Jump to content

more than one word issue


mtgriffiths

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/94620-more-than-one-word-issue/
Share on other sites

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']; ?>">

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.