如何在提交表单中发送字符串或使用 GET 变量接收字符串


How can I send a string in a submit form or receive a string using the GET variable

我有 2 个页面正在运行,第一页有许多单选按钮选项。示例之一选项是:

Hello World

当我将其提交到第二页并在第二页上打印出GET变量时,我得到的只是

Hello

我无法确定第一页是否只发送数组索引 0,或者 GET 功能是否只接受数组索引 0。

<?php
    while ($row = mysqli_fetch_assoc($data)) {
         print '<td><input type="radio" name="items" value='.$row{"items"}.'>'.$row["items"].'</td>';
    }
?>
<input type="submit" value="Submit">

如果 value 属性包含空格,则需要在它两边加上引号,否则值以空格结尾。如果值包含引号,您还应该使用 htmlspecialchars

print '<td><input type="radio" name="items" value="' . htmlspecialchars($row{"items"}) . '">'.$row["items"].'</td>';
                                                  ^                                       ^