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.


By explicitly ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.