0
votes

I get the following error message:

[24-Nov-2013 10:59:00 Europe/Stockholm] PHP Fatal error: require(): Failed opening required 'repregisration.php' (include_path='.:/Applications/MAMP/bin/php/php5.4.10/lib/php') in /Applications/MAMP/htdocs/reg4event/register.php on line 46

The script register.php looks like this where line 46 exists:

// Check if SESSION is SET
if ( (isset($_SESSION["RegType"])) && (isset($_SESSION["eventId"])) ) {
    // Check if it is a Rep Registration or a Guest Registration
    if ( $_SESSION["RegType"] == "rep" ) {
        // The Registration if of type "rep", require the repregistration script
        require "repregisration.php";

    } elseif ( $_SESSION["RegType"] == "guest") {
        // The Registration if of type "guest", require the guestregistration script
        require "/snippets/guestregistration.php";

    } else {
        // Neither of "rep" or "guest" was set in the $_SESSION["RegType"], hence header back to index.php page
        header("Location: index.php");
        exit();

    }
} else {
    header("Location: index.php");
}

The repregistration.php file contains this:

<?php
// Check which STAGE the Rep registration process is in
if ( !isset($_SESSION["RegStage"]) ) {
    // Include the Registration script
    require "/pages/repform.php";

} elseif ( isset($_SESSION["RegStage"]) == "review" ) {
    // Include the Review script for the registration to confirm their details
    exit("RegStage Review has not been created!");

} elseif ( $_SESSION["RegStage"] == "confirmed" ) {
    // Include the Confirmed information
    exit("RegStage Confirmed has not been created!");

} else {
    header("Location: index.php");
    exit();
}
?>

Why do I get the error message?

2
All the files in the same directory? - Darren

2 Answers

2
votes

Your file name is repregistration.php but your are including require "repregisration.php"; - there is a spelling mistake in your include line.

0
votes

It cant find the file. Try using require_once('...'); and try using Fully qualified paths. How to include PHP files that require an absolute path?

It is simply looking in the wrong spot for the file.