0

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.

enter image description here

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.

Community
  • 1
  • 1
Hemant
  • 33
  • 6
  • 2
    have you looked into jQuery/AJAX/POST logic making use of onclick event or something ? – Maximus2012 Jul 22 '13 at 15:51
  • @Maximus2012 Thank You for the comment. I am a novice in web development languages. I am learning these things on the need basis. It would be helpful if you can point me towards a tutorial maybe !! I have no clue about it.. Thank you. @.icodebuster---thanks for adding Image i could not do it due to bad reputation !! – Hemant Jul 22 '13 at 16:04

0 Answers0