jonas gmarao
jonas gmarao

Reputation: 21

cant read the value after space?

while($record= mysqli_fetch_array($myData)){

    echo "<form action=cpoarea1update.php method=post>";
    echo "<tr>";
    echo "<td><label>". $record['CODE'] . " </td>";
    echo "<td>". "<input type=text name=dt  value =" . $record['DOCUMENT_TITLE']. " </td>";
    echo "<td>". "<input type=text name=rv value=" . $record['REVISION']. " </td>";
    echo "<td>". "<input type=date name=dateis value=" . $record['DATE_OF_ISSUE']. " </td>";
    echo "<td>". "<input type=hidden name=hidden value=" . $record['CODE']. " </td>";
    echo "<td>". "<input type=submit name=update value=update " . " </td>";
    echo "</tr>";
    echo "</form>";

}
echo "</table>";

For example if the data in MySQL is "Hello my name is Maxim", I only see "Hello" in the textbox. What's the problem? Thanks in advance

Upvotes: 0

Views: 46

Answers (1)

fusion3k
fusion3k

Reputation: 11689

You have to wrap <input> attribute(s) by quotes. Also, you need to close tags!

echo "<td><input type=text name=dt  value =\"" . $record['DOCUMENT_TITLE']. "\"> </td>";
                                           ^                                 ^ ^

Your original code output this not valid HTML:

<td><input type=text name=dt  value =document title </td>

Best practice is to always use quotes:

<td><input type="text" name="dt" value="document title"></td>

Upvotes: 3

Related Questions