Please am trying to input points for 8 teams,with just one form. I want to compare and get the highest score after the form has been submitted. I have created the form, but am having a little problem. Am getting "Undefined offset: 8" error. but the scores and name of the team shows perfectly. Here is my html code
<div class="container">
<form method="post" action="../_libs/test.php">
<?php
foreach($teams as $arr)
{
?>
<div class="row team_result">
<div class="col-md-8">
<div class="row">
<div class="col-md-3"> <img class="img img-thumbnail" src="../_images/<?php echo $arr['Team_Logo']; ?>" width="50" height="50"> </div>
<div class="col-md-3"> <label> <?php echo $arr['Team_Name']; ?> </label> </div>
<div class="col-md-3">
<div class="input-group">
<input type="text" class="form-control" name="points[]" placeholder="points">
</div>
<input type="text" name="Name[]" id="" value="<?php echo $arr['Team_Name'] ?>"
style="display:none" >
</div>
</div>
</div>
</div>
<?php
}
?>
<div class="col-lg-6 col-lg-offset-4"> <input type="submit" class="btn btn-primary" name="submit" value="Post"> </div>
</form>
</div>
And the PHP code
<?php
//echo json_encode($_POST);
if(!empty($_POST['Name'])){
$team=$_POST['Name'];
$teams=count($team);
for($i=0; $i <= $teams; $i++)
{
echo $team[$i] .",". $_POST['points'][$i]."<br>";
// echo $teams;
}
}
?>