PHP只在表中显示字符串的第一个字 [英] PHP only displaying first word of string in table

查看:271
本文介绍了PHP只在表中显示字符串的第一个字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从MySQL查询动态创建表。由于某种原因,下面的notes字段只返回字符串的第一个字,虽然当我用 echo($ notes)测试它显示得很好。 $ status 类似地设置,也很好。我缺少什么?我假设它有关于用值预填充文本字段。我使用codeigniter。

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>'


推荐答案

replace此

   value='.$notes.'

    value="'.$notes.'"

双引号用于 Value 两个引号如: value =

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

这篇关于PHP只在表中显示字符串的第一个字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆