I'm trying to add multiple records to an attendance table in a mysql database. Having trouble building an array to check for the multiple entries with the same variables.
<?php
if (isset($_POST['submitted'])) {
include('connect-mysql.php');
$number = $_GET['number'];
for ($i = 0; $i <= $number; $i++)
{
$value = $_GET['value'];
$text = $_GET['text'];
}
$sqlinsert = "INSERT INTO attendance (value, text) VALUES ('$value', '$text')";
IF (!mysqli_query($dbcon, $sqlinsert)) {
die('error inserting new record');
} //end of nested if statement
$newrecord = "Records added successfully to the database";
} //end of the main if statement
?>
<html>
<head>
<title>Insert Data into Attendance Record</title>
</head>
<body>
<form method="post" action="insert-data.php">
<input type="hidden" name="submitted" value="true" />
<fieldset>
<table style="width: 400px">
<legend>Attendance</legend>
<tr>
<td><label>Early <input name="value[]" type="text" id="value[]" /></label></td>
<td><input name="text[]" type="hidden" id="text[]" value="Monday" /><label></td>
</tr>
<tr>
<td><label>Family <input name="value[]"type="text" id="value[]" /></label></td>
<td><input name="text[]" type="hidden" id="text[]" value="Wednesday" /><label></td>
</tr>
<tr>
<td><label>Evening <input name="value[]"type="text" id="value[]" /></label></td>
<td><input name="text[]" type="hidden" id="text[]" value="Friday" /><label></td>
</tr>
<input type=hidden name=number value=<? echo $number;?>>
</table>
</fieldset>
<br>
<input type="submit" value"add data" />
</form>
<?php
echo $newrecord
?>
</body>
</html>