Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2010
    Location
    Kenya
    Posts
    42
    Thanks
    4
    Thanked 1 Time in 1 Post

    Style data output from text file

    Hi,

    I have data in a text file that I read and output the data using php. The data appears as follows:

    name
    number
    message

    admin
    number
    message

    I would like to display the admin information on the right but retain the customer information on the left side; something similar to a chat display. Is this achievable? Thanks in advance.

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,095
    Thanks
    23
    Thanked 594 Times in 593 Posts
    You you can do this. It's done in HTML and CSS. See below, it is a php file YourFieName.php and not a HTML file YourFieName.html :
    PHP Code:
    <?php
    //Read your file here and then assign the variables
    $user_name "billy Preston";
    $user_number "1234";
    $user_message "Looking for a date for this Saturday";
    $admin_name "Big Kahona";
    $admin_number "64R8";
    $admin_message "This is an inapropirate message";
    ?>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta charset="UTF-8" />
    <title>Title of the document</title>
    <style type="text/css">
    body{
        max-width: 960px;
    }
    #container{
        width: 960;
        margin: 0 auto;
    }
    #user{
        width: 40%;
        padding: 10px;
        outline: blue 1px solid;
        float:left;
    }
    #admin{
        width: 40%;
        padding: 10px;
        outline: blue 1px solid;
        float:right;
    }
    </style>
    </head>

    <body>
    <div id="container">
    <div id="user">
        name : <?php echo $user_name?> <br />
        number : <?php echo $user_number?> <br />
        message : <?php echo $user_message?> <br />
    </div>
    <div id="admin">
        admin : <?php echo $admin_name?> <br />
        number : <?php echo $admin_number?> <br />
        message : <?php echo $admin_message?> <br />
    </div>
    </div>
    </body>

    </html>
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • Users who have thanked sunfighter for this post:

    bngari (03-25-2014)

  • #3
    New Coder
    Join Date
    Nov 2010
    Location
    Kenya
    Posts
    42
    Thanks
    4
    Thanked 1 Time in 1 Post
    Of all the things that I did not think of. Thanks a lot


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •