Php 如何将数据显示到循环输入字段中?

Php 如何将数据显示到循环输入字段中?,php,mysql,html,mysqli,Php,Mysql,Html,Mysqli,我正在尝试为我的测验生成器生成结果。我的测验生成器有不同的类别,在这些类别中,我希望为每个类别显示单独的结果。为了显示结果/分数,我循环了类别,并将其作为输入类型=按钮。我的按钮数据来自tbl_类别 SRPerCat.php $countcatrows是我希望显示在submit按钮旁边的文本字段中的值(带有类别的值) 就像,当我点击按钮(一个接一个)时,分数会出现在每个类别(按钮)旁边 没有人能理解。对不起,先生。我试图用最清楚的方式解释它| <?php session_start();

我正在尝试为我的测验生成器生成结果。我的测验生成器有不同的类别,在这些类别中,我希望为每个类别显示单独的结果。为了显示结果/分数,我循环了类别,并将其作为输入类型=按钮。我的按钮数据来自tbl_类别

SRPerCat.php

$countcatrows是我希望显示在submit按钮旁边的文本字段中的值(带有类别的值)


就像,当我点击按钮(一个接一个)时,分数会出现在每个类别(按钮)旁边

没有人能理解。对不起,先生。我试图用最清楚的方式解释它|
<?php
session_start();
?>
<?php 
$con=mysqli_connect("localhost","root","admin","learning_assessment") or die("cannot connect to database!");
$sqlcat="select * from tbl_category;";
$rscat=mysqli_query($con,$sqlcat);
$rowscat=mysqli_fetch_array($rscat);
?>

<form action="SRPerCat.php" method="post">

<?php do{?>
<table border="1">
<tr>

<th><input class="submitbtnsSTARTEXAM" type="submit" name="categories" value="<?php echo $rowscat['category'];?>" /></th>

<th><input type="text" name="scores" value="/*What to put here???*/" /></th>
</tr>
</table>

<?php }while($rowscat=mysqli_fetch_array($rscat));?>
<br /><br /><input class="submitbtnsSTARTEXAM" type="submit" name="sendmyscore" value="VIEW MY SCORE PER AREA" />
</form>
if(isset($_POST['categories'])){
$countcat="select * from tbl_corrects where category='$_POST[categories]' and correctorwrong='CORRECT' and username='$_SESSION[user]';";
$countcatrs=mysqli_query($con,$countcat);
$countcatrows=mysqli_num_rows($countcatrs);
echo $countcatrows;
}
?>