1
對於有經驗的用戶,我的問題可能很容易,但是我對此感到困惑。所以,這是問題。我在while循環中提交了按鈕,但是它們不會對點擊作出反應。這是我的一段代碼。在while循環中提交按鈕
`<?php
$zap_cmember = count_query("SELECT * FROM `users` WHERE `clan` = '".$member['id']."' AND clan_stat != 'Призывник'");
while ($cmember = mysql_fetch_array($zap_cmember))
{
$zap_gold = mysql_result(mysql_query("SELECT SUM(gold) FROM klog WHERE name = '".$cmember['name']."'"), 0);
$zap_online = mysql_num_rows(count_query("SELECT * FROM `online` WHERE `id_session`='".$cmember['id_user']."'"));
if ($zap_online > 0)
{
$img_on = "<td align='center' valign='middle' ><img src='images/ico_online.png' alt='онлайн' class='png' ></td>";
}
else
{
$img_on = "<td align='center' valign='middle' ><img src='images/ico_offline.png' alt='оффлайн' class='png' ></td>";
}
$i = 'set';
echo '<tr>
<td width="141" height="25" align="left" valign="middle" ><a href="player.php?id='.$cmember['id_user'].'" class="text_main_5">'.$cmember['name'].' ['.lvl($cmember['exp']).']</a></td>
<td align="center" valign="middle" ><span class="text_main_4">'.$cmember['clan_stat'].'</span></td>
<td align="center" valign="middle" ><span class="text_main_4">-</span></td>
<td align="center" valign="middle" ><span class="text_main_4">'.$zap_gold.'</span></td>
<td align="center" valign="middle" ><span class="text_main_4">'.$cmember['glory'].'</span></td>
'.$img_on.'';
if($boss)
{echo '<td align="center" id = "'.$i.'" valign="middle"><input type="submit" name="bSet" value="Назначить"></span></td>'; }
$i++;
$player = $cmember;
'</tr>';
if (isset($_POST['bSet']))
{
echo 'works';
count_query("UPDATE users SET clan_stat='Вождь' WHERE id_user='".$player['id_user']."'");
$time = date('j.n.y H:i');
count_query("INSERT INTO `message` (`time`, `to`, `text`, `metka`) VALUES ('".$time."', '".$player['name']."', 'Вас выбрали главой клана <a href=clan.php>".$clan['name']."</a>', '6')");
echo "<script>location.href='clan.php'</script>";
}
}
?>
`
這段代碼在'form'元素裏面是嗎?如果輸入類型不在表單中,則不會提交輸入類型提交... – Stuart