views:

59

answers:

2

I'm trying to build a sort of resource allocation form. I'd like to be able to print a table from a database, and then allow users to click on each cell that they would like to reserve. Also, being able to drag and select multiple cells. Then send all of this via $_POST to another php script.

Problem is, I have no idea where to start.

Any suggestions?

+1  A: 

The first and most critical thing you're going to need from what you described is a bunch of hidden fields to store the information you're interested in. You would have to write javascript code on the client side to store the users interaction with your page into these hidden fields.

To receive data via POST, you will need <input type="hidden" name"some_field"> for every bit of data you wish to "know" about that was changed on your page. Table information is not transmitted in a POST operation if it's just text, so you can't see the layout of the modified table on post back to the server.

If you don't have to POST this data to another form, it is probably a better idea to make callbacks via XMLHTTPREQUEST as the user interacts with your page, but I don't know the requirements of what you're trying to do.

jaywon
+1  A: 

I wrote one for my school recently; the trick is to either use buttons/links or addEventListener the cells to JavaScript. If you want the source code to my app, download this zip file:

http://azabani.com/files/busbook.zip

Edit:

My system works in the following way:

  1. addEventListener to cell clicks, calling book()
  2. book() then sets location to book.php
  3. book.php does the database work
  4. book.php sets the location header to immediately go back to the viewer

The system knows which week view to go back to based on session variables.

Delan Azabani