Doug Posted October 7, 2011 Share Posted October 7, 2011 Hello, I have a problem that I cannot, for the life of me, work out. I have a page where I have a login for people to enter certain parts of my website. I would like this to form art of my homepage. It works fine if I call it for example ‘index4.php’ but as soon as I change it to’ index.php’ (so it is the homepage) it stops working. Why would this be? It is exactly the same code only the name has changed I think the problem is in index1.php. I will put the home page and index1.php below. Thanks in advance for any help index.php <h4>Home</h4> <?php require_once('index1.php'); ?> <?php require_once('navmenu.php'); ?> <div id="newsstories"> <?php require_once('news.php');?> </div> <div id="maincontent1"> <?php require_once('poll/phpoll/poll.php');?> </div> <div id="mainpics"> <?php require_once('latestpicsmain.php'); ?> </div> rest of code... index1.php [code] <?php require_once('appvars.php'); require_once('connectvars1.php'); ?> <div id="index1"> <?php if (isset($_SESSION['username'])) { echo '<a href="viewprofile1.php">View Profile</a>'; echo ' '; echo '<a href="editprofile3.php">Edit Profile</a>'; echo ' '; echo '<a href="addcontent.php">Add Content</a>'; //echo '❤ <a href="logout3.php">Log out (' . $_SESSION['username'] . ')</a>'; } ?> </div> <?php // Connect to the database $dbc = mysqli_connect(DB_Host, DB_User, DB_Password, DB_Name); // Retrieve the user data from MySQL $query = "SELECT * FROM registration WHERE first_name IS NOT NULL"; $data = mysqli_query($dbc, $query); mysqli_close($dbc); ?> </body> </html> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/248647-same-code-works-unless-it-is-called-indexphp/ Share on other sites More sharing options...
Amit20 Posted October 7, 2011 Share Posted October 7, 2011 Which server are you using? By default, whichever server it is, when u call your domain it will search for index.html, index.htm, index.php or login.php. But since you say that when u change it to index.php your file is not fetched then you may have to check your server configuration. Quote Link to comment https://forums.phpfreaks.com/topic/248647-same-code-works-unless-it-is-called-indexphp/#findComment-1277069 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.