Chapter 5. Add Controls to Create, Edit, and Delete Events

Now that the calendar can be viewed, you need to add controls that will allow administrators to create, edit, and delete events.

Generating a Form to Create or Edit Events

To edit an event or add new events to the calendar, you need to use a form. You do this by adding a method called displayForm() that generates a form for editing and creating events to the Calendar class.

This simple method accomplishes the following tasks:

  1. Checks for an integer passed as the event ID.

  2. Instantiates empty variables for the different fields used to describe events.

  3. Loads event data if an event ID was passed.

  4. Stores event data in the variables instantiated earlier if it exists.

  5. Outputs a form.

Note

By explicitly ...

Get Pro PHP and jQuery now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.