Please see the attached image, What I want is when patient will open the the Appointment Registration form, he/she can select doctors from list, select available dates, enter his/her name, address, mobile number and save the form, a booking code will be generated, time will be assigned(starting a time, there will be a increment of 10 minutes for each patient, for example see the appointment_time, row in the appointment table), a booking code will be generated(using doctor id, appointment date and 4 digit number which will be increment 1 for each patient for that selected date and doctor, please see the booking_code in appointment_table).
booking code will start if a patient select another date and if there is no appointment, then it will again start from DR001-27-03-2016-0001.
Hope you can understand my problem, If I some one can help me with full codes, I will be very thankfull, I am new in PHP, Please Help me.