Currently my code outputs a name, the attendance stored currently in the SQL database, and a text box beside it, where the value for attendance can be changed.
As multiple names are being outputted I have a submit button at the end so that all of the values can be submitted at the same time. In order to check that the new altered value is being submitted for each user, I have an echo statement indicated by (a).Once the button has been submitted it should display the name and the new value for the attendance that has been submitted.
Once the submit button has been pressed however it says that there is a: Array to string conversion error on line (a). I would appreciate any ideas anyone has as to how I can solve this problem (thank you in advance).
//Here I have my SQL Statement (it's long so I haven't included it)
$rownumber = $sqlquery->num_rows;
while($row7 = mysqli_fetch_array($sqlquery, MYSQLI_ASSOC)){
echo $row7['FirstName'] . ' ' . $row7['LastName'] . ' "' . $row7['LessonAtt'] . '"' ;
$firstnameLabel = $row7['FirstName'];
$lastNameLabel = $row7['LastName'];
$attLabel = $row7['LessonAtt'];
$lessonID = $row7['LessonID'];
$error = '';
echo <<<_END
<form method='post' action='homepageInstructor.php?view=$user'>$error
<span class='fieldname'>
<input type ="text" name='attendance[]' value=$attLabel>
_END;
echo '<br>';
if (isset($_POST['attendance']))
{
$attLabel = $_POST['attendance'];
(a) echo $firstnameLabel . $attLabel . ' ';
}
}
This is the result when print_r($_POST['attendance']); is done
print_r($_POST['attendance']);?