Jump to content

[SOLVED] Delete or post to print txt file or pdf


emediastudios

Recommended Posts

i have a file that loads all my records from a table in my database.

What i want is to add the option of posting the info in a selected record to a file, either a pdf or text file so that it is printer friendy.

At the moment the only option available is to delete the record, can i add another button to my form to do what i am aiming?

Link to comment
Share on other sites

Thats probably not a bad idea.

At the moment my client gets to browse his application form records through his admin section.

Its all layed out and looks real stylish, i originally wanted to be able to give an option to post to pdf so he could print out his proccessed application forms for his records. He could then delete the record from his database.

Is this a big process?

If so i can have the info just post to  a simple php file without the graphics and make it printer friendy that way.

Can i just add a button beside the delete button (print) and have it post the form data to another file?

 

Link to comment
Share on other sites

you could dynamically display a pdf file with PHP/MySQL by creating a PHP page and setting the header("Content-type: application/pdf") for the PHP header and query your database to insert the content you wish to display for the printer friendly version.

 

 

check out the manual for more about PDFs in PHP: http://us2.php.net/pdf.

Link to comment
Share on other sites

I cant get the rest of the info to post, only the id?

is this because it was added to the button?

Can i get the rest of the info to post accross or can i draw it from the database using the id number to display the right record?

thanks so much for your help

 

 

database is your best bet for getting the rest of your variables.

Link to comment
Share on other sites

<?php

mysql_connect("localhost","username","password");
mysql_select_db("dBname");
$results = mysql_query("select * from tblName where id='$id'");
while($puller=mysql_fetch_array($results)) {

// List Your Variables Like This And So On......
$variable1=$puller["fieldNameHere"];

// Then Echo Out The Above Variables Where Ever You Want Them
echo "$variable1";

}

?>

Link to comment
Share on other sites

Thanks heaps for your help

Pasted this code in my page and it shows a blank page

 

<?php

mysql_connect("localhost","root","5050888202");
mysql_select_db("preparetowin");
$results = mysql_query("select * from application where id='$id'");
while($puller=mysql_fetch_array($results)) {

// List Your Variables Like This And So On......
$variable1=$puller["id"];

// Then Echo Out The Above Variables Where Ever You Want Them
echo "$variable1";

}

?>

Link to comment
Share on other sites

Fixed it up

had to put an extra line of code it

<?php
$id = $_GET['id'];
mysql_connect("localhost","root","5050888202");
mysql_select_db("preparetowin");
$results = mysql_query("select * from application where id='$id'");
while($puller=mysql_fetch_array($results)) {

// List Your Variables Like This And So On......
$variable1=$puller["id"];
$variable2=$puller["name"];

// Then Echo Out The Above Variables Where Ever You Want Them
echo "$variable1";

echo "$variable2";
}

?>

Your the best.

Thanks :-*

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.