duanhuren5581 2016-04-10 13:44
浏览 113
已采纳

在PHP中使用echo后未显示HTML元素

I am creating a form to update a database and used PHP to query the database and get current values before filling them in as the values already in the input boxes. I used echo to create the HTML elements while inserting the PHP variables however, the elements created aren't being displayed. Here are a couple of the inputs that I tried to make:

// Album Price
echo "<div class=\"row horizontal-center\">" .
"<input type=\"number\" step=\"0.01\" value=\"" . htmlspecialchars($albumPrice) . "\" name=\"albumPrice\"
" .
"</div>";

// Album Genre
echo "<div class=\"row horizontal-center\">" . 
"<input type=\"text\" value=\"" . htmlspecialchars($albumGenre) . "\" name=\"albumGenre\"
" .
"</div>";

Thanks in advance :)

  • 写回答

2条回答 默认 最新

  • dongxing4196 2016-04-10 13:47
    关注

    Your input elements are not properly closed with a > character. This code should work:

    "<input type=\"number\" step=\"0.01\" value=\"" . htmlspecialchars($albumPrice) . "\" name=\"albumPrice\" />
    " 
    

    Note the /> added in the end of the line. (the / due to <input> not having a closing tag)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法