0

Basically I have a bunch of data I get from a database and put onto my page in a table. Right now I have the user type in the name, session, etc. in the table and that is sent as post data into the next PHP page, which I then use to lookup more stuff in the DB and so on and so forth.

Obviously that's not a great user experience; it would be much easier to simply CLICK the item in the table and everything gets sent automatically into the next page.

I'm not sure how I'd go about doing this.

My tables are first and last names for now, so if you click a certain row it should go to the next page sending each cell as data.

EDIT: Some examples:

Traditionally you do this with a form

 <form method="post" action="pageDataIsGoingTo.php">

to send data to the next page. However, I don't want to do this with a form; but rather when they click a URL and/or button that sends the data. I can "hide" the data from view I suppose, but I still don't know the function to actually go ahead and do that.

Would I make a javascript button/function that sets something in an invisible form?

Brian Tompsett - 汤莱恩
  • 5,195
  • 62
  • 50
  • 120
Wuzseen
  • 647
  • 3
  • 12
  • 20

1 Answers1

1

You can use invisible/hidden form fields. That might be your best guess. Javascript would be a good solution if you wanted an ajax POST call, but you want to load other page. So hidden form fields are your solution.

Parallel with table data.

You need to embed hidden fields and your visible item row within a form (so each item row contains also a form & hidden form fields and visible submit button, which you can style with css)

This presuming that your table contains more items which you can choose to send.

Although I would do this with backbone & jquery and do it all in ajax.

tonino.j
  • 3,630
  • 25
  • 26