duanlan6259 2017-01-07 13:05
浏览 147
已采纳

意外''(T_ENCAPSED_AND_WHITESPACE)[重复]

error:

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\wamp\www\html\updatedtimeline.html on line 109

Im getting this error in my code and i would like to understand why? Thanks for any help

i want to add the email of the user logged in my html element

<h6 id="myemail">  </h6>

line 109:

echo "<script> document.getelementById('myemail').value= $_SESSION['email'] </script>";
</div>
  • 写回答

1条回答 默认 最新

  • dsfdgdsfd23212 2017-01-07 13:20
    关注

    Try following:

    <?php session_start();?>
    
        <h6 id="myemail">  </h6>
    
        <?php
            echo "<script> document.getElementById('myemail').innerHTML = '{$_SESSION['email']}'; </script>";
        ?>
    

    Please make sure that your echo should be placed after <h6 id="myemail"> </h6> is printed out.

    Please pay attention to the order of the code. You should make sure <h6 id="myemail"> </h6> is printed already before you echo script code.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?