dongmeng1868
2014-06-28 20:27
浏览 59
已采纳

解析错误:语法错误,* .php中的意外'='在线?

Every thing is OK.but i can not find why Parse error

my code

<?php
    if ($_REQUEST["submit"] == "ChangeTheBgColor")
        $bgcolor = strval($_REQUEST["thecolor"]);    
    else 
        $bgcolor = "white";
?>
<html>
<body bgcolor="<?php =$bgcolor; ?>" >
<form name= "color" method="get" action="<?php = $_SERVER['PHP_SELF'];?>">
Enter a Color: 
<input type="text" name="thecolor" value="">
<input type="submit" name="submit" value="ChangeTheBgColor">
</form>
</body>

</html>

I use devPhp .
Why I get the below Error and how Fix it?


Parse error: syntax error, unexpected '=' in C:\doc\demo.php on line 8


  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dp198879 2014-06-28 20:34
    已采纳

    You should write :

    <?php echo $_SERVER['PHP_SELF'];?>
    

    And not :

    <?php = $_SERVER['PHP_SELF'];?>
    
    已采纳该答案
    打赏 评论

相关推荐 更多相似问题