'Does the html code in php file to be included in other files need to be wrapped in <html> tag?
I have a signin.php file that can be used in multiple web pages where users can sign in via the pop up window. This file includes
<?php
//some code to process submitted sign up form
?>
<div>
// some html code for the sign in pop up window
</div>
I want to include signin.php in other html page files. Do I need to wrap the html code above with !DOCTYPE html, html, head, or body tag? I tested it seems it works without these tags. Thanks.
Solution 1:[1]
No, if your going to just include the tags from another file then you don't need to put the <html> tag because if your code is
<!DOCTYPE html>
<html>
<head></head>
<body>
<div>
<?php include("hello.php")?>
</div>
</body>
</html>
and in hello.php you just have an h1 tag with hello it will get rendered as
<div>
<h1>Hello</h1>
</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Axazexz player |
