Hi folks,
Was wondering if anyone could help me with this problem. I have a few ideas of ways round it but would like some advice before I go on and possibly waste my time. I've explained the problem below but if you skip to the bottom of this message you'll see it explained in simpler terms in pseudo code.
I have a form that a user fills in and it then submits to a database. The data is about courses that are being run at a particular place. The user adds the course details and includes the start date, the end date and the instructor that will be taking the course.
What I need is a way of checking that the instructor is available before the details are added to the database. The current system works really well but it is possible for an instructor to be assigned to more than one course on any given day. What is the best way to avoid this happening?
One final thing, the start date is split up into the fields start_day, start_number, start_month and start_year and the course end date is split into end_day, end_number, end_month, end_year. The maximum course duration is ten days so I also need to provide fields to enter all the dates that the course covers and get the form to check those as well.
The pseudo code for this is:
IF
A date entered in the form already exists
THEN
don't submit form to database
ERROR: Instructor not available on that date
form.focus = date
ELSE
submit form contents to database
show thank you page
END IF