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

解析错误:语法错误,第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 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀