Only one out of many exactly the same, dynamically generated forms doesn't work

i’m using a foreach loop and a class function to create a dynamic form of checkboxes and a submit button. On submit this then gets processed depending on what is checked. This all works except one of the form doesn’t submit. when i click the button it doesn’t seem to do anything. All the other ones seem to work however, and they are all generated the same way so i have no idea why only one is not working. i’m using jquery mobile framework. i dont’ know if its a PHP or jquery/ ajax problem, but it doesn’t make sense since only one of many identical forms isn’t working.

Excerpt from index.php

foreach($eventAdmin as $event){
			
				if($u->is_logged_in() and $u->is_admin()){
					$e->show_confirm_attendance("confirm.php", $event['event_id']);
				}
}

excerpt from event.class.php

public function show_confirm_attendance($post_to, $eventID){
		echo '<div data-role="collapsible" data-content-theme="e" data-theme="c">';
				$userscoming = $this->rsvp_event_volunteers($eventID);
                                  if($userscoming !=false){
                                       echo '<h3>Volunteers Sign up</h3>';
					
						echo '<form id="confirmattend'.$eventID.'" method="post" action="'.$post_to.'"  data-transition="pop" data-ajax="false">';
					foreach($userscoming as $user){
						echo '<label><input type="checkbox" name="users[]" value="'.$user['user_id'].'" />'.$user['user_fname'].' '.$user['user_lname'].' '. $user['eventVol_startTime'].' - '.$user['eventVol_endTime'].  '</label>	';
					}
					if($this->event_start($eventID)){
						echo '<input type="hidden"  name="eventid" value="'.$eventID.'"/>';

						echo '<input type="submit"  name="confirm" value="Confirm Attendance" data-theme="b"/>';
						echo '</form>';
					}
					}else{
						echo '<h3>NO Volunteers Signed Up</h3>';
						echo '<a href="addhours.php" data-role="button" >Manually Add</a>';
					}
					
					 echo '</div>';
	}

This is an excerpt from confirm.php


if($u->is_logged_in() and isset($_POST['eventid'])){
				$returned=$e->process_confirm_attendance();
				if($returned===true){
					
					echo "<h2>Hours Logged</h2>";

				}else{
					echo "Hour Logging Failed. ".$returned." Try again!<br>";
					
				}
		}

i’m completely confused and frustrated. any ideas would be greatly appreciated.

I think your event.class.php need to be like this:

<?php
   public function show_confirm_attendance($post_to, $eventID){
	   echo '<div data-role="collapsible" data-content-theme="e" data-theme="c">';
	   $userscoming = $this->rsvp_event_volunteers($eventID);
	   if($userscoming !=false)
	   {
		   echo '<h3>Volunteers Sign up</h3>';

		   if($this->event_start($eventID))
		   {
			   echo '<form id="confirmattend'.$eventID.'" method="post" action="'.$post_to.'"  data-transition="pop" data-ajax="false">';
			   foreach($userscoming as $user)
			   {
				   echo '<label><input type="checkbox" name="users[]" value="'.$user['user_id'].'" />'.$user['user_fname'].' '.$user['user_lname'].' '. $user['eventVol_startTime'].' - '.$user['eventVol_endTime'].  '</label>    ';
			   }
			   echo '<input type="hidden"  name="eventid" value="'.$eventID.'"/>';
			   echo '<input type="submit"  name="confirm" value="Confirm Attendance" data-theme="b"/>';
			   echo '</form>';
		   }
	   }
	   else
	   {
		   echo '<h3>NO Volunteers Signed Up</h3>';
		   echo '<a href="addhours.php" data-role="button" >Manually Add</a>';
	   }

	   echo '</div>';
    }
?>

Thank you so much.

I want the

 if($this->event_start($eventID))

where is was because i only want them to submit the form if the event has already started. however the form still needs to be complete. i didn’t’ realize i had also put the

 </form>

tag in that if as well. thus my form for the top events wasn’t closing. i realize now that the form with the problem was the first closed one, but since the ones above it were open it was getting confused and wouldn’t submit.

I’m glad I did point you to the problem area.