Include php into Html

Tyler

Retired Staff
Messages
8,564
Reaction score
0
Points
0
I know we have some coding guru's here so I thought I might ask. I made a poll with advanced poll 2.0.3 and I made a php page with the poll, but how do I include that php page in my html document? I have tried EVERYTHING! I cant rename my htm document to .php cause it gives me parse errors. I have tried all the inclued commands, nothing worked. Im stumped on this one. Hopefully you guys can help :grin:

Or if you dont know, do you know of a script to make html polls like advanced poll 2.03
 

Richard

Active Member
Messages
2,028
Reaction score
0
Points
36
Thats for server side includes not php.

This is how to include in php:
HTML:
[include.php]

<?php

    return "This is an included file";

?>


[somefile.php]

<html>
  <head>
    <title>Include a file/title>
  </head>

  <body>

    <?php include("include.php"); ?>

  </body>
</html>
 
N

Nathan

Guest
I know it's for SSI, but he said he got a parse error when he renamed his file to PHP to support the includes.
 

Tyler

Retired Staff
Messages
8,564
Reaction score
0
Points
0
Richard said:
Thats for server side includes not php.

This is how to include in php:
HTML:
[include.php]

<?php

    return "This is an included file";

?>


[somefile.php]

<html>
  <head>
    <title>Include a file/title>
  </head>

  <body>

    <?php include("include.php"); ?>

  </body>
</html>


But if I put that in, it messes the whole page up.
 
Last edited:

smasterross

New Member
Messages
16
Reaction score
0
Points
0
Just rename your document from .html to .php, it doesnt matter if a html is in a php file its just to allow the code:

PHP:
     <?php include("include.php"); ?>
to work and the file you include doesnt have to be a php file.

Thanks,
Steven Ross
 

Tyler

Retired Staff
Messages
8,564
Reaction score
0
Points
0
smasterross said:
Just rename your document from .html to .php, it doesnt matter if a html is in a php file its just to allow the code:

PHP:
     <?php include("include.php"); ?>
to work and the file you include doesnt have to be a php file.

Thanks,
Steven Ross
Gives me parse errors when I do that :eek:nline2lo
 
N

Nathan

Guest
Tyler said:
smasterross said:
Just rename your document from .html to .php, it doesnt matter if a html is in a php file its just to allow the code:

PHP:
     <?php include("include.php"); ?>
to work and the file you include doesnt have to be a php file.

Thanks,
Steven Ross
Gives me parse errors when I do that :eek:nline2lo

Maybe post your page's source on here so we can look at it.
 

Tyler

Retired Staff
Messages
8,564
Reaction score
0
Points
0
I Got it all sorted out, thank for your guys help :)
 
Top