简体   繁体   中英

Parse error: syntax error, unexpected '=' in *.php on line?

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


You should write :

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

And not :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM