View Full Version : Error displaying data in a <input> tag

11-30-2005, 11:19 AM
Hi all;

I'm experiencing a very extrange problem and I wonder if somebody can explain me what is going on:

I have a mysql table with the data of my clients, one of the fields is of course, 'name'. In this field, the admin stores the name and surnames of each client.

The HTML form works perfectly when you are typing in the data for the first time. The information is saved correctly into the database. If I want to print the name field, in a HTML form, it also shows as it is in the table, but the problem arise when I try to display the value in a 'input type' field, causing that what is displayed is all the content of the field BEFORE the first space character.

For instance:

stored value in the table: the blue cat
if I print it in a HTML form: the blue cat
if I try to display the value in a HTML form using input type= the

Below is an example in php:

function show_form_user($user)


//this works:
echo '<table width=80%><tr>';
echo '<tr><td><li><b>Name and Surname:</b></td>';
echo '<td>'.$user['nomape'];
echo '</td></tr></table>

// this is not working:

<form name=form_reg method=post action="upd_user.php" onsubmit="return check_reg2();">
<table border=0>
<td>Name and Surname:</td>
<td><input type=text name=nomape size=30 maxlenght=30 value=<? echo $nomape;?>>

11-30-2005, 11:38 AM
You should be getting a parsing error if that is your exact code. You don't have a '; after the last echo in your function.

11-30-2005, 03:02 PM
Also, this is one of those occasions where you'll probably need to have your attribute value quoted--apart from the fact that it's good practice to do so, anyway (if you're using an XHTML doctype it's even mandatory):

<input type="text" name="nomape" size="30" maxlenght="30" value="<? echo $nomape;?>">