hey guys,
I am not sure if this is the right place to ask this question but i was wonderring if you could print out a letter in a web page using html.
Actually m making a project in which if a user's form is accepted then a confirmation letter should be printed out.
I dont know if this possible or not but if it is then please suggest some ideas.

Without going into specifics at this point ...

You could use your server script, the one processing the form, to redirect the browser to the confirmation-letter page -- use this one

// process form here ...
header( 'Location: confirmation.html' );

You could use JavaScript to do the above after the form is submitted -- but I haven't tested this and you could be in conflict with the page reload when the form is submitted, so either this wouldn't fire or the form wouldn't submit (?).

<script type="text/javascript">
window.onload = function () {
  var form = document.getElementById('my_form');
  form.onsubmit = function () {
    location.href = 'confirmation.html';

Or you could use Ajax type techniques to print the letter to the existing form page after the page has reloaded from submitting the form ... which would require detecting when the page has reloaded after submitting the form and all that ... unless you submitted the form with Ajax techniques, in which case you would just trigger writing the letter to the page at that time ... but you would have to have a good reason to use this approach -- and providing an example for this approach is beyond the scope of this reply. :-)


This article has been dead for over six months. Start a new discussion instead.