Jump to content

Recommended Posts

I have a page that displays time slots people can sign up for by selecting checkboxes input elements.  for the <input> tag values, the "name"'s are the same, and the values are the date and time values of the time slot.  When I submit this form to the server (and have selected two or more checkboxes), only the most recently checked checkbox is coming through on my $_POST variable when it gets to the server. 

 

Here's the code I have on the page for the checkbox imput (this is inside of a loop that executes from a specified earliest time show to a latest time shown)

echo '<input type="checkbox" name="timeSlot" value="'.$date.';'.$startTime.';'.$endTime.'">';

 

Then server side I want to view all the checkboxes selected

//get the time slots the faculty member checked to be available for advising
$selectedTimeSlots = $_POST['timeSlot'];

echo $selectedTimeSlots;

 

So, for example, if I selected three checkboxes for the date 2008-11-17, for the times 8:00 AM-8:30 AM, 8:30 AM-9:00 AM, 9:00 AM-9:30 AM, the output of the variable server-side ($_POST['timeSlots']) is only the 9:00 AM-9:30 AM slot.

 

What am I doing wrong or how can I make the file do what I want to do, which is to have a collection of ALL the selected timeSlots?

 

Thanks in advance

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.