我需要为不同的排球队准备一份注册日志,在那里检查每次训练是否存在运动员。 我的SQL有以下表格: 标签1:运动员的名字 标签2:团队名称 表3:事件(现在/缺席/迟到/等) 选项卡4(register_log):日期,运动员姓名,球队名称,赛事
我已将PHP编码为注册矿石或更少,如下所示:
<?php
if (isset($_GET['squadra']) && $_GET['squadra'] =='I Divisione')
{
//gets the info of athlete name and team from tab 1 and 2
$query = "SELECT s.id_squadra, a.id_atleta, a.nome_atleta,a.cognome_atleta,a.id_squadra FROM squadre s, atlete a WHERE s.nome_squadra = 'I Divisione' AND s.id_squadra =a.id_squadra";
res = $mysqli->query($query);
while ($row = $res->fetch_array (MYSQLI_ASSOC))
{
// get the data that I need for the label and hidden fields
$id_squadra = stripslashes($row['id_squadra']);
$id_atleta = stripslashes($row['id_atleta']);
$nome_atleta = stripslashes ($row['nome_atleta']);
$cognome_atleta = stripslashes($row['cognome_atleta']); ?>
<div>
<form id="registro" name = "registro" method= "post" action="esito_registro.php">
<!--label name for the register_log-->
</br><label for ="atleta"> <?php echo $nome_atleta . " " . $cognome_atleta ?> </label></br>
<input type="hidden" id="id_squadra" value="<?php $id_atleta?>">
<input type="hidden" id="id_atleta" value="<?php $id_squadra?>">
<?php
//gets the values from the table events (tab 3) as a series of checkboxes for each athlete
$query_presenze = "SELECT * FROM var_presenze";
$res_presenze = $mysqli->query($query_presenze);
while ($row_presenze = $res_presenze->fetch_array (MYSQLI_ASSOC))
{
$id_var_presenze = stripslashes($row_presenze['id_var_presenze']);
$valore_pres = stripslashes($row_presenze['valore']);
//stampa i checkbox con presenza/assenze
?> <label><input type ="checkbox" id="id_var_presenze" value ="<?php echo $id_var_presenze; ?>"/><?php echo $valore_pres; ?></label>
<?php
}
} ?>
</br>
<input name="aggiorna_registro" type="submit" class="btn btn-default" value="Aggiorna registro" />
</form>
</div>
<?php
//la parentesi sotto chiude il primisso if(isset)
}?>
然而,为每个运动员复制了相同类型的场(如果我在队中有10名运动员,我将有10个复制的复选框和隐藏的场),$ _POST数组只带来最后一个隐藏输入和复选框(即那些对于列出的最后一名运动员。)
我可以得到所有这些吗?