dongnao3990
dongnao3990
2010-11-26 15:58

如何在表单中进行可变分页?

已采纳

i have page that contains a form, it works fine. but i want to add pagination to it. i've found an pagination example on the web. but, when i change the page, the values from the form are discarded, and i have to recomplete the form on the page that i want to.

i want to add pagination for 50 or 100 rows.

Any tips?

thanks, Sebastian

EDIT

i do submit the form. i want to use any way to paginate. add a drop box in the form, or an live drop box, below the table. after i submit the form, a table is printed with the entries from my database.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

3条回答

  • dongyue110702 dongyue110702 11年前

    I don't think he's submitting the form, but clicking a link?

    Whatever, as Swhistlesoft points out, you need to carry over the form values into the next page.

    If you're not submitting the form to load the next page, instead just clicking a "NEXT" link your best bet is probably a javascripted onclick event to add the contents of the form to the link as a $_GET[] URL rewriting appendage thing.

    ?page=2&formvalue=x&formvalue2=y&formvalue3=foo etc.

    then of course you'll need to get the landing page to re-insert this data into the form on generation.

    点赞 评论 复制链接分享
  • doubi9999 doubi9999 11年前

    This may not be the best way, but this will definitely look good. Have a big div with overflow:hidden, then have the pagination as buttons with onclick function to move the div's margin up and down thereby giving a feeling of pagination. Its an illusion without doing any dirty hacks to pass the data.

    点赞 评论 复制链接分享
  • dongtang7347 dongtang7347 11年前

    You will need to use sessions ( or cookies ) to save the previous page form values. Using sessions is probably the easiest as you can assign an array to the $_SESSION global variable.

    Then all you need to do is add some inline php code to each field to check if a value exists for that form field and echo it to the value attribute.

    点赞 评论 复制链接分享

相关推荐