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?

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?

 

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.

yeah - why not?

 

you could create a separate form with a submit button or just create a button and assign a javascript dom event - like "onclick".

 

 

example:

 

<input type="button" value="Printer Friendly" onclick="document.location.href='printfriendly.php';">

Ok that looks good, opens the right page, but how i get the info to post over to pf.php

I have these

 <?php echo $row_Recordset1['id']; ?> 

throughout my form.

I thought by putting this <?php echo $_POST['id']; ?> in my pf.php file the data would post across

I would just do it like this:

 

<input type="button" value="Printer Friendly" onclick="document.location.href='printfriendly.php?id=<?php echo $row_Recordset1['id']; ?>';">

 

Then query your "printfriendly.php" page with PHP/MySQL and set the layout how ever you want it to print out.

Ok i added your new code, sorry but im still a noobie, this code in my pf.php file doesnt show any details on id

 

<?php
</head>

<body>
Application Form Number <?php echo $_POST['id']; ?>
</body>
</html>
?>

form submission, as i have a repeated region showing all records in a repeating form, i was going to create form varibles and post them, i have this on a diffent site that sends the data from a form to a full details file that echoes form varibles, want to do the same thing i guess.

if your form is posting the variable - try this:

 


$fid = $_POST['id'];

Application Form Number <?php echo "$fid"; ?>

 

 

if your sending the variable through a query string (ie: printerfriendly.php?id=1)

 

try this:

 


$fid = $_GET['id'];

Application Form Number <?php echo "$fid"; ?>

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

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.

<?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";

}

?>

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";

}

?>

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 :-*

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.