Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9221515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:35:46+00:00 2026-06-18T03:35:46+00:00

I have a print.php script that basically fetches data from MySQL and creates a

  • 0

I have a “print.php” script that basically fetches data from MySQL and creates a tiny pretty HTML table.

echo "
    <table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" width=\"10%\">
        <tr bgcolor=\"#666666\">
            <td colspan=\"2\" align=\"center\"><b><font color=\"#FFFFFF\">" . $table[0] . "</font></td>
        </tr>
        <tr>
            <td>Name</td>
            <td>Score</td>
        </tr>";
echo "<tr";

    if ($i % 2 == 0)
        echo " bgcolor=\"#CCCCCC\"";

    echo ">
        <td>" . $col['player'] . "</td>
        <td>" . $col['score'] . "</td>
    </tr>";

I want this table to appear in my index.html, But its in a separate php script.

I want to keep the php script separate from the HTML because the script is not only a tad large, but it has my SQL information in it to which I don’t want in the plain HTML.

Is there a way to fetch this echo in my php script from my html page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:35:47+00:00Added an answer on June 18, 2026 at 3:35 am

    Option 1:
    Use an iframe. Works even if JavaScript is turned off.

    <iframe src="print.php"></iframe>
    

    Option 2: Use AJAX (with jQuery).

    Download jQuery here.

    Include it in your index.html, preferably in your head tag.

    <script type="text/javascript" src="path/to/jquery.js"></script>
    

    Add this code where you want print.php to be included.

    <div id="container"></div>
    
    <script type="text/javascript">
        $(function(){
            $("#container").load("print.php");
        });
    </script>
    

    Option 3: Go the PHP route. May break other code since you need to rename the index file.

    Rename your index.html to index.php and use this code:

    <?php include("print.php"); ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php script that will parse html page content link and view
I have three files in a folder 'test' one.php two.php print.html And i have
I have a <?php print $search_box; ?> in my page.tpl.php page. On pages that
Basically I hate a satellite website that is including form.php from an entirely different
I have a long running PHP script that has a memory leak which causes
I have php call an R script. When I call R from my php
I have a perl script that I am running from a browser. I'm passing
I have a script that sometimes break because I get an error like: PHP
I have a PHP script that parses an array using the json_encode() method but
I made some CMS in PHP which manipulates with data from MySQL. In my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.