Hi Folks,

To begin with, I know nothing about CSS - I have a PHP Calendar and I need to display my events for each month in the respective calendar month when it is selected.
I have been told I will need CSS to make it possible.
I will welcome your direction in seeing this through.

Dani AI

Generated

Brief, practical plan that answers and builds on while also addressing : combine one server-side month query, simple PHP rendering for each day cell, Bootstrap for layout, CSS for compact previews, and JavaScript (onclick) for full details.

Do this in three steps:

  1. Store events in a table with columns like id, title, start_datetime, end_datetime, description, all_day. Fetch every event for the month in a single query (do not run a query per day):
    SELECT * FROM events
    WHERE start_datetime <= 'YYYY-MM-01 23:59:59' /* month_end */
    AND end_datetime   >= 'YYYY-MM-01 00:00:00' /* month_start */;
  2. Render the calendar grid in PHP. For each day cell output a data-date="YYYY-MM-DD" and a small list of event titles (truncate to 1-2 lines). Example day markup:
    <div class="col day-cell" data-date="2025-10-15">
    <div class="date">15</div>
    <div class="events">
     <span class="badge bg-primary">Team mtg 10:00</span>
    </div>
    </div>
  3. Use CSS to keep each day tidy and show a visible indicator when events exist:
    .day-cell .events { max-height: 3em; overflow: hidden; }
    .day-cell.has-event { background: #f8f9fa; }

    Add a JS onclick (as suggested) to open a Bootstrap modal or popover that shows the full agenda for that date. For adding events (question from ) implement a simple form that posts to a PHP endpoint using prepared statements; store times in UTC and convert for display. Handle multi-day events explicitly (span logic) and show a “+N more” link when a day has too many items. Security note: always validate and use prepared statements to avoid SQL injection.

Recommended Answers

All 5 Replies

Any ideas?

It sounds like you need a JavaScript onclick event.

Well, may be I wasn't clear enough - but what I need done is to display the contents for AGENDA for an activity for each booked specific date / day into that months day / date column / box within the calendar.

example is what you may have with your google or outlook calendar where you can know just by looking at the calendar which dates / days you have activities booked.

Any ideas to display contents of a database table using CSS may help.

Can anyone tell me how to add events in php calendar ? ineesd to ADD EVENTS

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.