Please save me. I know that this question has been asked many times, however, I can't seem to find solutions that are relevant to my situation.
The problem: Warning: Cannot modify header information - headers already sent by (output started at /.../Sites/st.ambulance/resources/views/login.view.php:32) in /.../Sites/st.ambulance/resources/controllers/tables_.php on line 47
This is the code block with line 32:
<label>Month</label>
<select name="dob_month">
<?php for($i=0,$j=1;$i<sizeof($month);$i++,$j++){ ?>
<option value="<?php h($j) ?>"><?php h($month[$i]) ?></option> //line 32
<?php } ?>
</select>
The definition of the h function:
function h($s){
echo(htmlspecialchars($s,ENT_QUOTES));
}
This is tables_.php:
<?php
$error = "";
if(isset($_POST['guest_tables'])){
if(isset($_SESSION['logged_in']) && $_SESSION['logged_in']){
$guest = array();
$volunteer = array();
$guest = isset($_POST['guest']) ? $_POST['guest'] : null;
$volunteer = isset($_POST['volunteer']) ? $_POST['volunteer'] : null;
$seat_array = array($volunteer['seat_no'].$volunteer['table']);
$seat_count = 0;
$table_seat_error = "";
if($form->is_seatOccupied($volunteer['table'],$volunteer['seat_no']) != "")
$table_seat_error .= "Seat (".$volunteer['seat_no'].")
at table (".$volunteer['table'].") is currently occupied";
if($_SESSION['no_guests'] >= 1){
if($guest && $volunteer){
foreach($guest as $gue){
$seat_table = $gue['seat_no'].$gue['table'];
for($h=0;$h<sizeof($seat_array);$h++){
if($seat_table == $seat_array[$h] )
$seat_count = $seat_count + 1;
}
if($form->is_seatOccupied($gue['table'], $gue['seat_no']) != "")
$table_seat_error .= "Seat (".$gue['seat_no'].")
at table (".$gue['table'].") is currently occupied";
$seat_array[] = $seat_table;
}
if($seat_count == 0){
if($table_seat_error == ""){
for($d=0;$d<$_SESSION['no_guests'];$d++){
$_SESSION['guests'][$d]['table'] = $guest[$d]['table'];
$_SESSION['guests'][$d]['seat'] = $guest[$d]['seat_no'];
}
$_SESSION['volunteer']['table'] = $volunteer['table'];
$_SESSION['volunteer']['seat'] = $volunteer['seat_no'];
$form->set_guests($_SESSION['guests']);
$form->set_volunteer($_SESSION['volunteer']);
header('location: /branch/menus.php'); //line 47
exit();
}
else{
$error = $table_seat_error;
}
}
else{
$error = "You have selected the same seat for two or more
people: one person, per seat, per table. Only.";
}
}
}
else{
$_SESSION['volunteer']['table'] = $volunteer['table'];
$_SESSION['volunteer']['seat'] = $volunteer['seat_no'];
if(!$form->is_seatOccupied($_SESSION['volunteer']['table'],
$_SESSION['volunteer']['seat']) != ""){
$form->set_volunteer($_SESSION['volunteer']);
header('location: /branch/menus.php');
exit();
}
}
}
}
?>
EDIT: would it help to know that I'm trying to handle multiple forms on a single page?