Search code examples
phpnavigation

Navigating pages in php


So I have been reading around on google, and it is just a mess of different answers, with not much explanation.

My question is how do you switch between PHP pages? Suppose I have a directory on my server that has the following files in it:

index.php
about_us.php
contact_us.php

Lets suppose on all 3 pages, I have a header with 3 links:

Home
Info
Contact

What should happen when one of the buttons (lets say Contact) is hit?

I have read about 3 techniques:

Php: header("contact_us.php")
javascript: window.location = "contact_us.php";
html: <meta http-equiv="Refresh" content="5; URL="contact_us.php">

Are any of these preferred by today's standards? I read somewhere that you aren't supposed to use php's header() function now.

Any insight would be very great to help me make my decision :)


Solution

  • Just make them regular links

    <a href="contact_us.php">Contact</a>