PHP only displaying first word of string in table

青春壹個敷衍的年華 提交于 2019-12-24 15:59:00

问题


I'm dynamically creating a table from a MySQL query. For some reason, the 'notes' field below is only returning the first word of the string, although when I test it with echo($notes) it shows up just fine. $status is similarly set, and also is fine. What am I missing? I assume it has something to do with prepopulating the text field with the value. I'm using codeigniter.

$notes = empty($row["notes"]) ? "None" : $row["notes"];
    echo($notes);
    echo('
    <tr class="even">
        <td class="status-icons">'.$error_level.'</td>
        <td>'.$row["name"].'</td>
        <td>'.$status.'</td>
        <td class="notes-col">
          <input type="text" name="submit_notes" value='.$notes.' class="notes-copy">
        </td>
    </tr>'

回答1:


replace this

   value='.$notes.'

with

    value="'.$notes.'"

the double quotes are for the Value because it originally has two quotes like: value=""



来源:https://stackoverflow.com/questions/17891778/php-only-displaying-first-word-of-string-in-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!