View Full Version : Handling space character in Forms

12-08-2010, 12:04 PM
This is probably a simple question but I am struggling and would appreciate help please.

I have a MySQL database and am retrieving data using PHP.

When I display the last name of people I use the following line in my Form....

<td class=\"main_body_med\" width=\"150\" align=\"center\">" . $row["last_name"]."</td>

This displays the name correctly even when the name has a space in it (for example the surname is "Foster Jones").

However, when I wish to amend the details of the person and I use the following line in my Form....

<td><input type=\"text\" name=\"last_name\" size=\"30\" value = ".$row["last_name"]." ></td>

only the first part of the surname ("Foster") is displayed.

Can someone please advise me how to display the full name on the amendment Form? (Note that the amendment does work even changing the surname)

12-08-2010, 12:26 PM
you forgot to put "" quotes
<td><input type=\"text\" name=\"last_name\" size=\"30\" value = \"".$row["last_name"]."\" ></td>

12-08-2010, 01:55 PM
Thanks very much for your help. How silly of me!!! Thank you adarshakb for spotting my faux-pas. Much appreciated.