Getting $ _POST variable from table

I am trying to create some kind of resource allocation form. I would 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. In addition, the ability to drag and select multiple cells. Then send it all via $ _POST to another php script.

The problem is that I do not know where to start.

Any suggestions?

+4
source share
2 answers

The first and most important thing that you will need from what you have described is a bunch of hidden fields for storing the information you are interested in. You will need to write client-side javascript code to keep users interacting with your page in these hidden areas.

To receive data through POST, you will need <input type="hidden" name"some_field"> for each bit of data that you want to "know" about it that has been changed on your page. The information in the table is not transmitted in the POST operation if it is just text, so you cannot see the layout of the modified table after sending it to the server.

If you do not need to publish this data in another form, it might be better to make callbacks through XMLHTTPREQUEST as the user interacts with your page, but I do not know the requirements of what you are trying to do.

+1
source

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

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

Edit:

My system works as follows:

  • addEventListener for addEventListener clicks by calling book()
  • book() then sets location to book.php
  • book.php whether the database is running.
  • book.php sets the location header to return immediately to the viewer

The system knows which week view will return based on the session variables.

+1
source

Source: https://habr.com/ru/post/1309173/


All Articles