无法读取空间后的值?

时间:2016-03-15 01:52:51

标签: php

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>";

例如,如果MySQL中的数据是“Hello my name is Maxim”,我只在文本框中看到“Hello”。有什么问题?提前致谢

1 个答案:

答案 0 :(得分:3)

您必须用引号括起<input>个属性。此外,您需要关闭标签!

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

您的原始代码输出的这个无效HTML:

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

最佳做法是始终使用引号:

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