Click here to Skip to main content
15,883,127 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Main folder name is: Masterpage
file of master page: masterpage.php
Inside Main folder: Another folder called Pages
Insides Pages: file called doctorwelcome.php
And again inside main folder: Anothe folder called doctorlogin
Inside doctor login: file is uploadimage.php

Now I want to call uploadimage.php in doctorwelcome.php

Code goes here:

<style type="text/css" media="all">
   @import "bootstrap/css/doctorwelcome.css";
</style>


<?php
	session_start();
?>

<div class="container doctorwelcome">
	<div class="row">
		<div class="col-md-4">
			<ul>
				<li><a href="./index1.php?doctorlogin=uploadimage" class="btn btn-default">Upload Image</a></li>
				<li><a href="index1.php/doctorlogin/uploadvideos.php" class="btn btn-default">Videos</a></li>
				<li><a href="./doctorlogin/uploadaward.php" class="btn btn-default">Award</a></li>
				<li><a href="./doctorlogin/uploadcertificates.php" class="btn btn-default">Certificates</a></li>
				<li><a href="./doctorlogin/clinictiming.php" class="btn btn-default">Clinic Timing</a></li>
				<li><a href="./doctorlogin/clinicdetails.php" class="btn btn-default">Clinic Details</a></li>
				<li><a href="./doctorlogin/clinicpricing.php" class="btn btn-default">Clinic Pricing</a></li>
			</ul>
		</div>
		<div class="col-md-8">
			 <?php 
            if(isset($_GET['doctorlogin']))
            {
              $page_name = $_GET['page'];
              include("./doctorlogin/".$page_name.".php");
            }
            else
            {
              include("./doctorlogin/uploadimage.php");
            }

          ?>

		</div>
	</div>
</div>


What I have tried:

Problem in php calling function
Posted
Updated 14-Apr-17 3:10am

1 solution

If the above is showing the content of doctorwelcome.php then you need to go UP one dir level before going back down, so rather than:
PHP
include("./doctorlogin/".$page_name.".php");

you should be using:
PHP
include("../doctorlogin/".$page_name.".php");

Note two 'dots' rather than one, which is navigating (relatively) from the current "Pages" directory to its parent which is "Master", then "/doctorlogin/" is taking you back down into the dir where uploadimage.php resides.

Your use of "./" means simply "the current dir".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900