+ 1
Paste html in php
When I paste html in a php-file in vs-code, I go line by line pasting echo ' in front and '; at the end of my html-code. This does not seem to be the best way to do that. So... any suggestion?
1 Answer
+ 1
Why do you use echo for all the html code? That's not necessary, you can write the html like in a html document and when you need to use php just add <'?php your php code here ?>
Example, in a php file:
<!DOCUMENT html>
<html>
<head>
....more html code
</head>
<body>
<'?php
$user = $_GET['NAME'];
echo '<h1>' . $user . '</h1>' ;
?>
<h2> Welcome to this page </h2>
...more html code
</body
</html>
Important, the code <'?php doesn't carry the ' but I couldn't write without it here