开发者

can we use form for every tr to the single table? and how? [closed]

开发者 https://www.devze.com 2023-04-02 19:43 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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:

  1. Have a single form wrapping the entire table and differentiate the submitted values on the server-side.
  2. Don't use a table for the layout and wrap style-aligned divs in the form tags.
  3. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消