Santosh Kumar
Santosh Kumar

Reputation: 27875

Right way for embedding HTML into PHP

I have a define.php page that has many variables in it. I use to include in any other PHP file I make.

There is a variable named $encodingdeclaration which has <meta http-equiv="Content-Type" content="text/html; charset=utf-8">.

The script now is becoming unresponsive: that because of an extra semicolon used after text/html, What to do?

Upvotes: 0

Views: 130

Answers (3)

Gilly
Gilly

Reputation: 9692

Use this code

$encodingdeclaration = '<meta http-equiv="content-type" content="text/html;charset=UTF-8" />';

Upvotes: 0

Philip
Philip

Reputation: 4592

meta http-equiv should be moved to .htaccess file Adding it inline the way you do will cause html validating to fail.

If its a html5 page, simply add the below before your [title] tag

<meta charset="UTF-8" />

Also use double quotes for strings such as these.

$encodingdeclaration = "<meta charset=\"UTF-8\" />";

Upvotes: 2

Jason
Jason

Reputation: 13766

I can't really tell without you providing the actual code, but make sure that you're using single quotes around your string, since double quotes might conflict. A semi-colon will not have any impact as long as it's properly enclosed in a string.

Upvotes: 0

Related Questions