Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 695963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:00:51+00:00 2026-05-14T03:00:51+00:00

I am designing a job rota planner for a company and need help displaying

  • 0

I am designing a job rota planner for a company and need help displaying a dynamic table containing the staff details. I have the following tables in MySQL database: Staff, Event, and Job. The staff table holds staff details (staffed, name, address…etc), the Event table (eventide, eventName, Fromdate, Todate…etc) and the Job table holds (Jobid, Jobdate, Eventid(fk), Staffid (fk)).
I need to dynamically display the available staff list from the staff table when the user selects the EVENT and the DATE (3 drop downs: date, month, and year) from a PHP form.
I need to display staff members that have not been assigned work on the selected date by checking the Jobdate in the Job table.
I have been at this for all day and can’t get around it. I am still learning PHP and would surely appreciate any help I can get.
My current code displays all staff members when an event is selected:

 if(isset($_POST['submit'])) 
 { 
$eventId = $_POST['eventradio'];

 }
 $timePeriod = $_POST['timeperiod'];
 $Day = $_POST['day'];
 $Month = $_POST['month'];      
 $Year = $_POST['year'];
 $dateValue = $Year."-".$Month."-".$Day;
 $selectedDate = date("Y-m-d", strtotime($dateValue));

//construct the available staff list
if ($selectedDate)
    {
        $staffsql = "SELECT s.StaffId, s.LastName, s.FirstName
        FROM Staff s 
        WHERE s.StaffId NOT IN
        (SELECT J.StaffId
        FROM Job J
        WHERE J.JobDate = ".$selectedDate.")";
        $staffResult = mysql_query($staffsql) or die (mysql_error());

    }
if ($staffResult){
    echo "<p><table cellspacing='1' cellpadding='3'>";
    echo "<th colspan=6>List of Available Staff</th>";
    echo "</tr><tr><th> Select</th><th>Id</th><th></th><th>Last Name
        </th><th></th><th>First Name </th></tr>";

    while ($staffarray = mysql_fetch_array($staffResult))
    {
        echo "<tr onMouseOver= this.bgColor = 'red' onMouseOut =this.bgColor = 'white' bgcolor= 
            '#FFFFFF'> <td align=center><input type='checkbox' name='selectbox[]'
            id='selectbox[]' value=".$staffarray['StaffId'].">
            </td><td align=left>".$staffarray['StaffId']."
            </td><td>&nbsp&nbsp</td><td align=center>".$staffarray['LastName']."
            </td><td>&nbsp&nbsp</td><td align=center>".$staffarray['FirstName']."
            </td></tr>";
    }
        echo "</table>";
    }
    else {
        echo "<br> The Staff list can not be displayed!";
    }       
    echo "</td></tr>";
    echo "<tr><td></td>";
    echo "<td align=center><input type='submit' name='Submit' value='Assign Staff'>&nbsp&nbsp";
    echo "<input type='reset' value='Start Over'>";
    echo "</td></tr>";
    echo "</table>";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:00:51+00:00Added an answer on May 14, 2026 at 3:00 am

    You need to do 1 of 2 things.

    a.) add an onchange event to your select list and make an AJAX call to your server to pull back the table data, or

    b.) add an onchange event to your select list and submit the form/page to itself (thus including the value selected from the select list

    In your PHP (either way) using the parameter on the request (if it exists) load the applicable data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A little help please. I am designing a stateless server that will have the
I need to split my job with my partner for designing game stages, and
I have attended a job interview. The interviewer asked me why you need private
I am designing the following application: A job applcation system allowing for students to
When designing a C API for configuring a library/utility, I have a co-worker who
Im designing a website, and often I need to present information in a nice
while designing my user control, i encountered the following problem: i would like to
When designing a form I have the option of putting a close button at
I am designing the API for a service that deals with Job entities. I
Lets say I am designing a tool foobuzzle (foobuzzle's exact job is to set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.