PHP redirect not working - php headers -


when load index.php file, header.php,sidebar.php, or nav.php don't show up. used "include" correctly, , in validators there no error. of files work themselves. here code.

index.php

<!doctype html>  <html>  <head>  <title>homepage</title>  <style> @import url(stylesheet.css)  </style> <meta charset="utf-8"> </head> <body> <div id ="header"> <?php include('header.php');?> </div>  <div id="navigation"> <?php  include('nav.php'); ?> </div>  <div class = "homepagemain" id="homepagemain"> <h2><strong><em>what zapdebate?</em></strong></h2> <p>zap debate website can debate on hot topic. find topic      want , fight! debates out 14 days @ time, , whoever gets      likes wins debate!zapdebate place practice debating, or share  opinion. go on! fight!</p> </div>  <div id = "sidebar"> <?php include('sidebar.php');?> </div>  </body> </html> 

header.php

<!doctype html> <html>   <h1 class="header"><strong><em>zap debate</em></strong></h1>  </html> 

nav.php

<!doctype html> <html>   <ul id="nav"> <li><a href="#">debates</a></li> <li><a href="#">recent news</a></li> <li><a href="#">hot topics</a></li> <li><a href="#">suggest debate!</a></li> </ul>  </html> 

sidebar.php

<!doctype html> <html>    <h2 class="sidebar">popular searches</h2>  </html> 

i'm guessing have apache server started, php enabled.

the next step make sure relative path other files correct. mean? means :

<?php include('sidebar.php');?> 

this code assumes sidebar.php , page accessed, in case index.php on same folder. if not, should make relative path till there. example if index.php in /root folder , sidebar.php in /root/tempfolder/ should:

<?php include('tempfolder/sidebar.php');?> 

also, after that, when other files loaded , can see them, should strip html in files include, jeroen has suggested.

edit: assuming don't have apache server started.

asuming you're on windows, install local server wamp, easyphp or xampp, start it, copy content in local root folder(www, localweb or htdocs, if remember correctly) , should enter go live following url: localhost.

for xampp tutorial please follow : this one


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -