Jump to content

Put elements from one page into another page


Recommended Posts

This is the main page. It take elements from the open_empty php file. The open_empty file has 3 parts on it. Header in which I have  a logo image, footer that has a mailto element and in the middle a block i named external_block.

I want to put all my other php pages into the area i declared external_block. Now it put the class i called "logon" beneth the footer. I want to put it in the area of the external_block. How can I do that?

Here are the files

php file: index.php (I removed irelevant parts from the file)

<!DOCTYPE html>

<?php
    require_once("../xxx/Includes/GlDbOra.php");
    include("../xxx/open_empty.php");
    $logonSuccess = false;

    //get user details
    if (isset($_POST['userid_typed']))
    {
        $userid=$_POST['userid'];
        $stid = (DBOracle::getInstance()->get_user_details($userid));
                while ($row = oci_fetch_array($stid, OCI_ASSOC))
        {
            $username=$row['USERNAME'];
            $password=$row['PASSWORD'];
        }
    }
    
       if (isset($_POST['compid_typed']))
    {
        $userid=$_POST['userid'];
        $username=$_POST['userid_desc'];
        $compid=$_POST['compid'];
        $compname = (DBOracle::getInstance()->get_company_name($compid));
    }

?>

<html>
    <head>
        <meta charset="UTF-8">
        <title>Login</title>
        <script type="text/javascript" src="../../php-ajax/jquery-3.5.1.js"></script>
        <link href="../xxx/global_style.css" type="text/css" rel="stylesheet" madia="all"/> 
    </head>
    <body>
        <div class="logon">
            <form name="logon" id="logon" action="index.php" method="POST" >
                <span style="clear: both; float: left; margin-top: 20px; ">
                    <label for="userid">User Id</label>
                    <input type="text" name="userid" id="userid" class="regular_textbox" value="<?php echo $userid ?>" placeholder="<?php echo userid; ?>"/>
                     <input type="text" name="userid_desc" id="userid_desc" class="regular_textbox" value="<?php echo $username ?>" readonly="readonly" disabled="disabled"/>
                    <label for="password">Password</label>                    
                    <input type="password" name="password" id="password" class="regular_textbox" placeholder="<?php echo password;?>"/>
                </span>
                <span style="clear: both; float: left; margin-top: 20px">
                    <label for="compid">Company</label>                    
                    <input type="text" name="compid" id="compid" class="regular_textbox" value="<?php echo $compid ?>" placeholder="<?php echo compid;?>"/>
                    <input type="text" name="compid_desc" id="compid_desc" class="regular_textbox" value="<?php echo $compname ?>" readonly="readonly" disabled="disabled" />
                    <label for="language">Language</label>                    
                    <input type="text" name="language" id="language" class="regular_textbox" placeholder="<?php echo language;?>"/>
                    <input type="text" name="language_desc" id="language_desc" class="regular_textbox" value="" readonly="readonly" disabled="disabled" />
                </span>
                <span style="clear: both; float: right; margin-top: 20px">
                    <input type="submit" value="Login" id="login" style="margin-right: 500px; border-radius: 40px ; text-align:center;width: 220px; height: 30px;" class="" placeholder="<?php echo login;?>"/>
                </span>                    
            </form>
        </div>
    </body>
</html>




 

php file: open_empty.php - contains only html in it

<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <div class="logo_image"> 
            <form name="logo_image" id="logo_image" > 
                     <img class="img" src="Images/logo_transparent.png" alt="header" />
             </form>
        </div>
        <br>
        <div class="external_block">
        </div>
        <br>
        <div class="footer"> 
            <form name="footer" id="footer" >
                <footer>
                    <a href="mailto:info@xxx.com">Contact Us</a>
                </footer>
            </form>
        </div>
    </body>
</html>

css file: global_style.css

body {
  margin: 5px;
  background-color: rgb(245,245,235);
}

.logo_image{
    transform: scale(0.5) translate (-110%, -100%);
    color: #0a2430;
    border-top-right-radius: 10px; border-bottom-right-radius: 10px; border-bottom-left-radius: 10px; border-top-left-radius: 10px;
    box-shadow:         5px 3px 7px 1px rgba(51, 51, 60, 0.61);
}   
    
.regular_textbox  {
    border-radius:  10px; 
    text-align:center;
    width: 230px; 
    height: 20px;
}

label {
    float: left;
    width: 85px;
    font: 18px 'Exo Medium 500', tahoma;
}

.footer
{
    border-top-right-radius: 10px; border-bottom-right-radius: 10px; border-bottom-left-radius: 10px; border-top-left-radius: 10px;
    box-shadow: 5px 3px 7px 1px rgba(51, 51, 60, 0.61);
    height:30px;
}
.external_block, .logon
{
    border-top-right-radius: 10px; border-bottom-right-radius: 10px; border-bottom-left-radius: 10px; border-top-left-radius: 10px;
    box-shadow: 5px 3px 7px 1px rgba(51, 51, 60, 0.61);
    height:720px;
}
input {
    display: run-in;
    float: left;
    margin: 6px;
}
 

Thank you

Link to post
Share on other sites

The easiest option is to split your file into two parts: one for all the content before the external_block (including the opening tag for it) and one for the content after it (including the closing tag). Put each into a function. Then your regular scripts include this common file, call the first function, output what they want, and call the second function.

To pass information into the header, like the title of the page, use function arguments.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.