/    Sign up×
Community /Pin to ProfileBookmark

variable to file error (parsing error)

[code=php] $content = “<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN” “http://www.w3.org/TR/REC-html40/loose.dtd”>
<html>
<head>
<meta http-equiv=’Content-Type’ content=’text/html; charset=UTF-8′>
<link rel=’stylesheet’ type=’text/css’ href=’css/panel-style.css’>
<script src=’js/mapping.js’ type=’text/javascript’></script>
</head>
<body>
<img src=’../imagens/maserati-mc12-corsa.jpg’ style=’position:absolute; left: 150px; top:80px;’>
<div id=’panel’ class=’panel’>
<div class=’move’ onmouseover=’over=true;’ onmouseout=’over=false;’ style=’cursor:move’>
<img src=’imagens/lampada.png’><a href=’#’ onclick=’getXYPosition(event);’><br>Colocar</a>
</div>
</div>
</body>
</html>”;

// Write $somecontent to our opened file.
if (fwrite($handle, $content) === FALSE) {
echo “Cannot write to file ($filename)”;
return;
} [/code]

Error: Parse error: syntax error, unexpected ‘<‘ in C:ProgramasApache Software FoundationApache2.2htdocsFinalPageMappingcreate_mapping.php on line 12

please help, how can I write to file the html content????

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@SheldonJun 05.2007 — [code=php]

//escape the " inside your main ".

$content = "<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<link rel='stylesheet' type='text/css' href='css/panel-style.css'>
<script src='js/mapping.js' type='text/javascript'></script>
</head>
<body>
<img src='../imagens/maserati-mc12-corsa.jpg' style='position:absolute; left: 150px; top:80px;'>
<div id='panel' class='panel'>
<div class='move' onmouseover='over=true;' onmouseout='over=false;' style='cursor:move'>
<img src='imagens/lampada.png'><a href='#' onclick='getXYPosition(event);'><br>Colocar</a>
</div>
</div>
</body>
</html>";


// Write $somecontent to our opened file.
if (fwrite($handle, $content) === FALSE) {
echo "Cannot write to file ($filename)";
return;
} [/code]
×

Success!

Help @davser spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...