duanlu1793 2013-07-22 05:44
浏览 81
已采纳

php回显内的echo回显

I'm trying to use checkboxes to display and update records in a MySQL database. I want to change the value of the checkbox based on whether it's checked or unchecked. But I'm getting this error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

Here's the line of code that's throwing the error:

echo"<input type='checkbox' name='PLJan' {if (isset($_POST['PLJan'])) print 'value='checked''} $row->PLJan /> January ";

Is there a better way for me to do this so that saving it will update the database with 'checked' if the box is checked, and a blank if the box is unchecked?

Thanks in advance for the halps.

  • 写回答

5条回答 默认 最新

  • donglunzai4288 2013-07-22 05:48
    关注
    echo"<input type='checkbox' name='PLJan' {if (isset($_POST['PLJan'])) print 'value='checked''} $row->PLJan /> January ";
    

    should be

    echo"<input type='checkbox' name='PLJan'"; 
    if (isset($_POST['PLJan'])) { echo " value='checked'"; } 
    echo $row->PLJan . "/> January ";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题