doumen6532 2013-11-13 07:47
浏览 60
已采纳

解析错误:语法错误,第7行意外T_CONSTANT_ENCAPSED_STRING - <div class ='dInlineB'align =“left”> [关闭]

I am getting error on line 7 syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

<div id='login_form_container'>
    <div class='dInlineB' align="left">
        <label class='login_form_label' for='email'>Email:</label>
        <input type='email' name='email' id='email' tabindex="1" class='login_form_input'<?=(isset($_POST['email']) ? " value='']."'" : "");?>
    </div>
        <div class='dInlineB' align="left">
        <label class='login_form_label' for='password'>Password:</label>
        <input type='password' name='password' id='password' tabindex="2" class='login_form_input' />
    </div>
    <div align="left">
        <div class='login_form_spacer'>&nbsp;</div>
        <div class='dInline fs11'>
            <label for='login_form_stay'>
                <input type='checkbox' name='stayLogged' tabindex="3" checked='checked' value='1' id='login_form_stay' />

                Keep me logged in
            </label>
        </div>
  • 写回答

4条回答 默认 最新

  • duangang4001 2013-11-13 07:50
    关注
    <input type='email' name='email' id='email' tabindex="1" class='login_form_input'<?=(isset($_POST['email']) ? " value='']."'" : "");?>
    

    is malformed, please see the following correct line:

    <input type='email' name='email' id='email' tabindex="1" class='login_form_input'<?=(isset($_POST['email']) ? " value='".$_POST['email']."'" : "");?>>
    

    Code highlighting here on SO already shows where your error is at. What you missed was adding the value from $_POST to your input. In order to add PHP variable in a string you have to append the PHP like this: "this is a string" . $variable . " continued string" or with single quotes: 'this is a string' . $variable . ' continued string'.

    Using double or single quotes depends on whether you want to be able to use variables inline as well, which works on double, but not on single quotes: "this $variable works inline" . 'but the $variable doesn\'t work here'. For more info about the double/single quotes: What is the difference between single-quoted and double-quoted strings in PHP?

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

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记