Print version of form results of MySQL database

Print version of form results of MySQL database

Posted by: kevylyap
Posted on: 2008-11-29 09:29:00

I have created a form which "GETS" information from a MySQL database when the user submits the form.

<form name="example" method="get" action="result.php">
<input name="submit" type="submit" class="button" value="Submit Form" >
</form>

The results are displayed on a "result.php" page, in which I have provided a link to another page which is simpler in design so that it can be printed ("printable.php")

Example of the code at the "result.php" link is:

<a href="printable.php" target="_blank">Print this page</a>

However, when I click on the link, the print page shows many errors and the database results are not seen on the "printable.php" page.

Eg. of error:
"Warning: Invalid argument supplied for foreach() in /home/....../script.php on line 18"

What is wrong? Has it anything to do with my links? When I link the <form action="printable.php"> , I don't get the errors and the results can be seen.

How can I make the "result.php" into a printable version? My result.php consists of many tables, but I want the printable version to be just words

Would appreciate help from anyone...

Re: Print version of form results of MySQL database

Posted by: scjessey
Posted on: 2008-11-30 09:29:00

As soon as you link to the "printable" version, all your variables lose their values because you are not passing them on in a querystring. You can get around this using session variables, but a more elegant solution would be to use CSS to create a print version of the existing page (the page will print differently from how it looks on the screen).

-- si-blog --