This topic is locked

'print' button in 'add new' page

12/10/2007 1:11:15 PM
PHPRunner General questions
M
Metiz author

Hi guys, new to the forum
Sorry to ask these kind of questions in my first post but I'm in quite a pickle here
I'd like to add a "print" button in the "add new" page, next to the save button so I am able to print the data I just added without going back to the main page, selecting the row and clicking "printer friendly page". Is this possible?

I've created a simple coalition database with SQL (wamp5) and have run phprunner over it without any significant changes other then default. Unfortunately it is not as easy as putting a simple print code in the page.
Also, in my database I have a "date" field wich I set to text and then made my phprunner script. now I'd like to change it to "datestamp" in my db. is this possible without remaking the runner script? when I just make it into "datetime", I get "0000-00-00 00:00:00" in my database imput
again, sorry to ask this of the bat,

any help is appreciated.

Admin 12/10/2007

After record is added user is on the empty Add page. Printing something without seeing it is not a good idea.
After record is added you can redirect user to the View page which can be printed. To achieve this use the following code in AfterAdd event:

header("Location: table_name_view.php?editid1=" . $keys["KeyColumnName"]);

exit();

M
Metiz author 12/12/2007

thank you for your quick reply - sorry for my slow one.
in wich file should I add this code string?
regards

joost

Admin 12/13/2007

Joost,
add this to the After record is added event on the Events tab in PHPRunner.

M
Metiz author 12/19/2007

finally got around doing this and it works like a charm, thanks a lot guys!
now there's one more thing I need to get going with this and that is a custom print page. there are 2 options as far as I see: aligned vertically and aligned horizontally. Id like to have my output on one page but aligning vertically is not going to cut it - I need to rearange the tables to my own liking so more of the page is being used. Is there also a way to do this in phprunner or should I edit the <tr>and <td> elements in "data print.htm" (freely translated from dutch) page?
Thanks for helping me out so far,

Joost

J
Jane 12/19/2007

Joost,
you can check off vertical layout on the Fields order and totals tab, build your project, then rename ..._print.php to ..._print2.php and change link on the view page to this changed file.

M
Metiz author 1/17/2008

Thank you for all the answers guys, you have realy helped me out. I've been busy at work and have not been able to reply sooner, sorry for that. Also, I have yet one more problem - sorry to keep nagging on about this.
for some reason, when I'm on the "print" page, ALL the records in my database are on 1 page, all under each other. Is there any way to limit the amount of records to 1, namely the one record I checked in the (I think) "dataview_list.php", the page you get when you open your project and can see the records you have added in your database, or from the data_add page, wich I link to the print page with the above code:
[codebox]header("Location: table_name_view.php?editid1=" . $keys["KeyColumnName"]);

exit();
[/codebox]
?
thank you very much for your time,

Joost.

J
Jane 1/21/2008

Hi,
you can edit your link to the print page on the view page manually.

Here is a sample:

<a href="..._print.php?editid1={$show_key1}">Print</a>


And then modify SQL query for the print page in the Print page: Before SQL query event on the Events tab.