0

I'm trying to create a registration page to add data from that registration form to the database. But the page does not appear when I go on it. It shows this error up:

Fatal error: Cannot redeclare showHeader() ( views/view_fncs.php:5) in views/view_fncs.php on line 14

This is the views_fncs.php file. Nothing seems wrong with it at all so I'm not sure where the error is coming from in the file.

 <?php

function showHeader($title="The Films Site")
{
echo '<!DOCTYPE HTML>';
echo '<html>';
echo '<head>';
echo '<title>'.$title.'</title>';
echo '<meta http-equiv="content-type" content="text/html;charset=utf-8" />';
echo '</head>';
echo '<body>';
}

function showNavigation()
{
echo '<ul>';
echo '<a href="all-films.php">View Films</a></li>';
echo '</br>';
echo '<a href="add-films.php">Add Film</a></li>';
echo '</br>';
echo '<a href="delete-films.php">Delete Films</a></li>';
echo '</br>';
echo '</ul>';
}

function showFooter()
 {
    echo '</body>';
    echo '</html>';
 }
?>

The error comes up when I try to load up the registration.php page so here is the code for that in case the error originates from that file:

   <?php
    header("Cache-control: no-store, no-cache, must-revalidate, max-age=0");
    header("Cache-control: post-check = 0, pre-check=0", false);
    header("Pragma: no-cache");
    include("config/config.inc.php");
    include("helpers/db_fncs.php");
    include("models/film-model.php");
    include("views/view_fncs.php");

    $conn=getConn();
    $register=register($conn);
    $conn=NULL;
    include("views/registration-view.php");

    ?>
  • 3
    Have you tried replacing `include` with `include_once`? It's possible that function file is being included multiple times which is causing it to attempt to redeclare the function. – jfadich Apr 25 '16 at 17:12
  • Check [this](http://stackoverflow.com/a/1953870/5447994) – Thamilhan Apr 25 '16 at 17:24

0 Answers0