Php 在表单中发布表格

Php 在表单中发布表格,php,mysql,Php,Mysql,我有一张表格里的桌子。大多数字段通过循环由数据库中的数据填充。但是我还有两个输入字段,用户将在其中输入一些结果,然后提交表单。提交时,应使用这些结果更新数据库 当我加载页面时,该表将显示所有数据。但是,在表的上方,我在第37行的C:\xampp\htdocs\testsite\test-predictions.php中收到一条错误消息“注意:未定义索引:(输入框显示在这里,而不是在表中!!)。它显示了十次,即两个字段乘以生成的行数。代码如下: <?php include 'includes

我有一张表格里的桌子。大多数字段通过循环由数据库中的数据填充。但是我还有两个输入字段,用户将在其中输入一些结果,然后提交表单。提交时,应使用这些结果更新数据库

当我加载页面时,该表将显示所有数据。但是,在表的上方,我在第37行的C:\xampp\htdocs\testsite\test-predictions.php中收到一条错误消息“注意:未定义索引:(输入框显示在这里,而不是在表中!!)。它显示了十次,即两个字段乘以生成的行数。代码如下:

<?php
include 'includes/dbh.inc.php';
?>

<div class="predictions_container">
<form class="predictions" name="predictions" action="test-predictions.php" method="post">
<table class="table">
<thead>
<tr class="active">
<th>Match ID</th>
<th>Match Date</th>
<th>Locked</th>
<th>Home Team</th>
<th>Home Score</th>
<th>Home Score</th>
<th>Away Score</th>
</tr>               
</thead>            
<?php
// Get data to fill table columns

$sql = "SELECT match_id, matchdate, locked, hometeam, awayteam from matches";
$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
    while ($row = $result-> fetch_assoc()) {
        echo "<tr class='info'>
                <td>". $row["match_id"] ."</td>
                <td>". $row["matchdate"] ."</td>
                <td>". $row["locked"] ."</td>
                <td>". $row["hometeam"] ."</td>
                <td>". $row["awayteam"] ."</td>
                <td>". $row["<input type='text' name='homescore'/>"] ."</td>
                <td>". $row["<input type='text' name='awayscore'/>"] ."</td>
              </tr>";
    }
} else {
    echo "No results";
}
$conn-> close();
?>

</table>        
<td><input class="submit" type="submit" size="30" value="Submit" /></td>        
</form>
</div>

<?php

匹配ID
比赛日期
锁定
主队
本垒打
本垒打
客场得分

问题在于:

”$第[“”]行。

将其更改为:


只是有点语法混乱。

您正在尝试访问索引:

输入类型='text'名称='homescore'

输入类型='text'名称='awayscore'


哪些是未定义的

请始终显示完整的错误消息。非常感谢。该问题已解决。