php在线考试系统,题号传输问题

单选题收集每一题的随机题号,name为啥要用‘a‘表示

 

<form action="getAnswer.php" method="post"> 
                    <?php
                        include_once('conn.php');
                        $sum=1;
                        $result=mysqli_query($conn,"select*from exercise order by rand() limit 10");
                        $names=1;
                        $x='a';
                        while($row=mysqli_fetch_assoc($result)){    
                    ?>
                        <ul>
                        <li><?echo $names;?><? echo ".";?><?=$row['text']?></li><br />
                        <li><input name="<?=$names?>" type="radio" value="A"><?=$row['textA']?></li>
                        <li><input name="<?=$names?>" type="radio" value="B"><?=$row['textB']?></li>
                        <li><input name="<?=$names?>" type="radio" value="C"><?=$row['textC']?></li>
                        <li><input name="<?=$names?>" type="radio" value="D"><?=$row['textD']?></li>
                        <input name="<?=$x?>" type="hidden" value="<?=$row['id']?>">//收集题号
                        </ul> <hr />
                    <?
                    $names++;$x++;
                    }
                    ?>
                    <center><input class="btn" name=submit type="submit" value="提交" style="cursor:pointer;" onclick="sub()"></center>
                </form>

因为你后台是通过$_POST['name']获取的

html代码

<form action="welcome.php" method="post">
    名字: <input type="text" name="fname">
    年龄: <input type="text" name="age">
    <input type="submit" value="提交">
</form>

welcome.php

欢迎 <?php echo $_POST["fname"]; ?>!<br>
你的年龄是 <?php echo $_POST["age"]; ?>  岁。