Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Problem ... I want to print a series of numbered forms

Just occasionally, we come across problems that sound easy but end up looking like they need specialised software that's going to cost money to buy for a single use, before we evel look at the time to learn into it. One such problem has cropped up today in that I want to print out a series of sequence numbered forms for completion by people at an event (actually the event being on a train!)

Problem ... I want to print a series of numbered forms
will also provide methodology for
Problem ... I want to print a series of sheets with randomised information in some field(s)

Solution
... generate the form as a series of web pages using a PHP Counter
... use a meta refresh to step through the pages
... Add an request to print on load <body onload="window.print()">
... Set up Firefox to silently autoprint
   - visit about:config
   - confirm you know what you're doing ;-)
   - right click on options and select new
   - add in print.always_print_silent as a boolean
   - set it to true

Basically, we're using Javascript to automatically print, Firefox to print silently, HTML to generate the pages, with meta refresh to step through them, and PHP to increment our count.

Here's a sample PHP page that I used to test out this mechanism - it prints out five pages ...

  <?php
  $page = 1;
  if ($_REQUEST[page]) $page = $_REQUEST[page] + 1;
  ?>
  <html>
  <head>
  <?php if ($page < 5) { ?>
  <meta http-equiv="refresh" content="10; url=?page=<?= $page ?>">
  <?php } ?>
  </head>
  <body onload="window.print()">
  Hello World - page <?= $page ?>
  </body>
  </html>


More about setting the Firefox option [here].

We teach PHP [course details] ...

(written 2014-10-05, updated 2014-10-07)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
H312 - PHP - Tips and Techniques
  [789] Hot answers in PHP - (2006-07-02)
  [917] Syntax checking in PHP - (2006-11-07)
  [1010] Dates, times, clickable diarys in PHP - (2006-12-28)
  [1270] PHP Standalone - keyboard to screen - (2007-07-18)
  [1649] Easy conversion - image formats, currencies and distances - (2008-05-21)
  [1667] Checking server performance for PHP generated pages - (2008-06-06)
  [1684] Two PHP include files to make easy web site indexing and navigation - (2008-06-21)
  [1958] PHP - Parse error: syntax error, unexpected $end ... - (2008-12-23)
  [1983] Keeping PHP code in database and running it - (2009-01-09)
  [2025] Injection Attack if register_globals in on - PHP - (2009-02-04)
  [2274] PHP preg functions - examples and comparision - (2009-07-08)
  [2478] How did I do THAT? - (2009-10-26)
  [2981] How to set up short and meaningfull alternative URLs - (2010-10-02)
  [4074] A comment on comments in PHP - (2013-04-28)
  [4319] PHP - some quick fixes if scripts have issues, and how to use our support - (2014-11-19)
  [4426] FileMaker Day to Unix Time conversion - (2015-02-15)
  [4621] The power of scripting - (2016-01-12)

W602 - Web and Intranet - Client Side Technologies
  [411] Javascript examples (some PHP and MySQL too) - (2005-08-13)
  [522] Javascript events - a good example - (2005-12-09)
  [1322] Flash - is it available to your web page? - (2007-08-26)
  [1681] Adding a button to a web page to print the page - (2008-06-18)
  [1749] Using server side and client side programming together - (2008-08-11)
  [1812] Starting Ajax - easy example of browser calling up server data - (2008-09-27)
  [1813] Ajax - going Asyncronous and what it means - (2008-09-28)
  [1814] Javascript/HTML example, dynamic server monitor - (2008-09-28)
  [2390] Dynamic / changing images on your web page - (2009-09-01)
  [2628] An example of an injection attack using Javascript - (2010-02-08)
  [3128] How does your browser find out about itself? - (2011-01-11)
  [4277] Sending a message to the server and changing text on a page when a button is pressed - (2014-05-23)


Back to
Even in the dark of night, the train comes bearing passengers
Previous and next
or
Horse's mouth home
Forward to
Melksham Campus - how is it going - October 2014
Some other Articles
PHP training - refreshed modern course, backed up by years of practical experience
Moving community rail support from amateur to professional
Officially overcrowded in the first year
Melksham Campus - how is it going - October 2014
Problem ... I want to print a series of numbered forms
Even in the dark of night, the train comes bearing passengers
What can you and I learn from online quizzes?
Identifying and clearing denial of service attacks on your Apache server
Four time target - good news. Four time prediction - poor forecasting.
Learning to program in Java - yes, we can help.
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.info/mouth/4310_Pro ... forms.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb