HTML无法显示烧瓶返回的全名

时间:2020-06-28 07:23:35

标签: html flask web-development-server

我想知道为什么输入字段仅显示Varun而不显示Varun Achar

以下是我的HTML页面的代码。

{%if users%}
  <label >
    Patient ID
  </label>
  <input type="text" name="PID" value={{  users[1]  }}>
  <label >
    Patient Name:
  </label>
  <input type="text" name="pname" value={{  users[2]  }} />   
{%endif%}

在命令提示符下,其打印Varun Achar,但在前面的HTML输入字段中,仅打印Varun

请帮助解决此问题

1 个答案:

答案 0 :(得分:0)

您只需要将value用双引号引起来。

{%if users%}
  <label>
    Patient ID
  </label>
  <input type="text" name="PID" value= "{{users[1]}}">
  <label>
    Patient Name:
  </label>
  <input type="text" name="pname" value="{{users[2]}}"/>
{%endif%}