hi ... im searching on google and i cant find it....

how to display the texts form my main html form to another html form?....since i didnt know how to hide the textboxes and select list for printing the html form... my plan is that

im gonna pass all the displayed data from my main html form to another html form which has a print button there.. so that when i print only the text (the html elements like buttons and txtbox will
"not" be included)..


a clearer explanation ( i have a textbox on my main html form then i displayed it on the
other page)

[this is a textbox]-----------------> this is a textbox <---im gonna print this w/o the box

Recommended Answers

All 11 Replies

you must submit the form, action page will be your second page, where you want to display text. Here (second page) you can access fields by using GET or POST array.

you must submit the form, action page will be your second page, where you want to display text. Here (second page) you can access fields by using GET or POST array.

can u give me some demo? ( a piece of code something like that)

UselessNinja,

That's an unnecessarily complicated approach.

CSS will do the job for you with @media rules.

<style type="text/css">
  /* General rules here */

@media screen {
  /* screen rules here */
}

@media print {
  /* print rules here */
}
</style>

Read more about it here:
http://webdesign.about.com/cs/css/qt/tipcssatmedia.htm

With selective use of eg. display:none , border-width:0 etc. in the print block, you can simply suppress those elements you don't want to print.

Airshow

UselessNinja,

That's an unnecessarily complicated approach.

CSS will do the job for you with @media rules.

<style type="text/css">
  /* General rules here */

@media screen {
  /* screen rules here */
}

@media print {
  /* print rules here */
}
</style>

Read more about it here:
http://webdesign.about.com/cs/css/qt/tipcssatmedia.htm

With selective use of eg. display:none , border-width:0 etc. in the print block, you can simply suppress those elements you don't want to print.

Airshow

thankzz btw....its not waht you think dude (im not asking for finish code) ...im just asking for clearness :)

Very quickly (wearing the wrong glasses and untested) :...

<style type="text/css">
  input.border { border: 1px solid #000; }

@media print {
  .noprint { display: none }
  .noprintborder { border-width: 0 }
}
</style>
...
<select class="noprint" ...>.....</select>
<input class="noprint"... />
<input class="border noprintborder"... />
...

...
<tr class="noprint">
<td>
<button ...>Calculate</button> 
<button ...>Reset</button> 
<button ...>Submit</button> 
</td>
</tr>
...

Airshow

thank you dude for you answer ...umm can i ask one last question?

is it possible to display the contents of a textbox from my main form to my 2nd html form?

  • If the forms are on the same page - easy - use javascript to read the value from one form field and write it into the other form field.
  • If the forms are on different pages - slightly harder.
    • Solution 1: Submit the form then use php (or other server-side scripting environment) to build the second page complete with value(s) written into its form. Tens of millions of web pages do this kind of thing every day.
    • Solution 2: Submit the form then serve the second page with empty form fields. Also include some javascript to read values from the url and insert them into the empty fields. This solution is not commonly employed as it is only necessary where server-side scripting is not available.

Airshow

ahh kk thankzz though :)

  • If the forms are on the same page - easy - use javascript to read the value from one form field and write it into the other form field.
  • If the forms are on different pages - slightly harder.
    • Solution 1: Submit the form then use php (or other server-side scripting environment) to build the second page complete with value(s) written into its form. Tens of millions of web pages do this kind of thing every day.
    • Solution 2: Submit the form then serve the second page with empty form fields. Also include some javascript to read values from the url and insert them into the empty fields. This solution is not commonly employed as it is only necessary where server-side scripting is not available.

Airshow

Dear Airhsow, Isn't it unnecessarily complicated approach now.
I was trying to explain same thing in my first post to this thread, according to the user requirement, and you felt it "unnecessarily complicated approach ".

Hi Urtrivedi,

Yes, totally correct.

I think that Uselessninja is on the steep part of the web-dev learning curve and wants to know as much as possible about all aspects, not just a simple solution to the immediate problem.

Best wishes

Airshow

Dear Airshow, thanks for clarification

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.