can we use form for every tr to the single table? and how? [closed]
I need to apply form for every tr to a single table. That tr have 3 or 4 tds. But table in tr shouldnt use. Is this possible?
This the 开发者_C百科example - http://jsfiddle.net/PBGXA/
Just put your form tags into whatever cell of the table. Nothing wrong with it
You can have as many forms as you want on a single HTML page, just keep in mind that each one will post only the values within itself. Though I don't think it would be valid HTML to have the form tags break up the table's markup (like, have a form
tag between the table
and the tr
tags). You can consider:
- Have a single form wrapping the entire table and differentiate the submitted values on the server-side.
- Don't use a table for the layout and wrap style-aligned divs in the form tags.
- If you're really keen on using tables and multiple forms, you may have to have a primary table with single-cell rows which contains the forms and then each form's cell contains an inner table with the columns. It would be more valid HTML, but it would be messy.
I'd recommend option 1 or 2.
If all of the forms post to the same resource then I'd really suggest option 1. You can still have multiple submit buttons and differentiate which one was clicked in server-side code.
just put <form>
before <table>
and </form>
after </table>
. That's the easiest (and probably the only) way
<form method="post" action="">
<table>
...
</table>
</form>
or better one, do not use tables
精彩评论