javascript - How to show data from the generated php page to the another page?

214

I need some help with this problem: I have site on server which don't support php. But I want to make page with data using php and sql. And I created it. But I don't know how to show pars of variables: summ and date. My code:

<?php
require 'scripts/connect.php';
$sql_select = "SELECT * FROM zadol";
$result = mysql_query($sql_select);
$row = mysql_fetch_array($result);
do
{
printf("<p>Company: " .$row['company'] . " " .$row['summ'] ."</p> 
<p>Date: " .$row['date'] . "</p>---------<br/>"
);
}
while($row = mysql_fetch_array($result));
?>

Then I want to take this variables and show on another page (without php support). How can I do this? Thanks for your help.

407

Answer

Solution:

The two simple options are:

  1. Make the PHP script a webservice that you request from the 'non-php' server using an ajax call and use javascript to fill the page.

  2. Use an iFrame in which you load the php page.

    <iframe src='http://www.example.com/externalpage.php'>This browser doesnt't support iframes</iframe>
    

People are also looking for solutions to the problem: How to pick a random word from text file (array) using PHP?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.