How to set the html page header-php Tutorial

Source: Internet
Author: User
How to set the html page header to edit index. php & lt; at the end of this post from dd0607 to 2014-01-0601: 42: 27 ;? Phpinclude (includeconn. php); include (header. php); include (footer. php );? & Gt; conn. php & lt ;? How to set html page headers in php

This post was last edited by dd0607 at 01:42:27 on

Index. php
 include("include/conn.php");
include("header.php");
include("footer.php");
?>


Conn. php
 $host='localhost';  
$user_name='root';
$password='123123';
$db='netbox';
$conn = mysqli_connect($host,$user_name,$password,$db) or die("Connect failed: " . mysqli_connect_error());
?>


Header. php






test





Footer. php





When index. php does not load conn. php, the page is displayed normally.
When the conn. after php, the page will add html tags such as html/head/body and remove my header. DOCTYPE/html/head in php, and other contents are all thrown into the body. why?

PS: load conn. php and right-click the page to view the source code. it is normal, but if there is a problem, a blank line is displayed at the top of the page, IE11 and Chrome33 press F12 to view the HTML code and you will find it is abnormal.



I just switched from ASP to PHP. it's okay to write logic like ASP. I don't know where the PHP problem is.

Share: More


------ Solution --------------------
Check conn. php comments row by row

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.