I am making an appointment booking website! I managed to create a calendar using php which updates automatically. Now, the slots that are visible are all buttons of form with each one corresponding to one form.
If the user click on one of the buttons i want a data to be written in a sql database.
The name
of the button tag is automatically chosen as date slot
(for eg 2013-7-23 2:00 - 3:00 PM
). If user clicks a button I will check $_POST['date slot']
and insert the entry with username in the database.
Could anyone please help me out with this?
My solution till now is to generate various if loop in the form submitted php file automatically each day. But i have the concern that it may slow down the process since the program has to go through number_of_days*number_of_slots if loop for each query OR maybe not. Can anyone confirm this? Will it make the Website Slow?
EDIT : I looked at the jquery post option mentioned in the comment, The problem is still the same (I think!! doesn't understand fully maybe). Let me rephrase: the name tag of the form is dynamic that is it set's up according to the date and changes everyday.
For example if you look at the answer of this question the php file argument $bar = $_POST['bar'];
the bar is a fixed quantity in which the value is stored and known by the user, but in my case it is changing, though i know the range so i have to right again many if loops. The question is how to avoid this.