0

i referred a site which said that using the include() we can include code of another page into the current page

But i am not getting the output as they showed.

this is my code

<html>
 <head>
     <style type="text/CSS">
       body
         {
          background-color:#696565;
            font-style:italic;
         }
    h1
    {
     color: green;  
     text-decoration:underline;
     font-style:italic;
     text-shadow:2px 2px #FAF8CC;
    }
     </style>
  <title>
     home page
  </title>
 </head>
 
    <body>
 
      <h1>  <center>   Get to know something  </center> </h1>
    <?php
       include("include.php");
       echo "hello";
    ?>
    </body>    
</html>

and the code for include.php is

<html>

  <head>
  <style type="text/css">
   
   
   a:link
    {
      color:red;
       text-decoration:none;
      
       
    }

    a:visited
      {
         text-decoration:none;
        color:red;
      }
    a:hover
      {
        color:brown;
         text-decoration:underlined;
          background-color:#FF8247;
      }
  
  </style>
  </head>
   <body>
     <table border=1 cellspacing=0  align ="center" >
       <tr>
        <td><a href="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>home</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td>
        <td><a href="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>about us</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td>
        <td><a href="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>info</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td>
        <td><a href="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>login</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td>
       </tr>
     </table>  
   </body>

</html>

and what is got as output didnt contain the include.php file
can anyone help me please
thanks in advance

3
Contributors
8
Replies
9
Views
5 Years
Discussion Span
Last Post by moneeshot
0

You should not include two html headers in the same page. Just include the table.
Is your main file a PHP file? What you get?

0

"You should not include two html headers in the same page. Just include the table."
i didnt get this point
i am having only one <html> start and end tags in my file

0

thanks for the reply
the main file is not having .php as extension
it is a html file
so its not giving the required output
thanks for helping me :)

0

Great :)
On the two headers, it seems to me that you have an html header on main page, and another one on include.php, that will output two headers.
Bye :)

Edited by cereal: n/a

0

if the the main file is not PHP then you will need to to change it to a PHP file. you can't put a PHP code block in an HTML file end expect any results. And you only want the table in the include file like noted above, but that would not cause the issues you are having. IF you have not already change the main files extension. it may help in the future to make all your file's php.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.