Php 提交单选按钮选项后重定向到其他页面

Php 提交单选按钮选项后重定向到其他页面,php,forms,radio-button,Php,Forms,Radio Button,我的表格有问题。我需要它重定向用户到不同的网页根据单选按钮被选中。用户必须从两个选项中选择一个,然后单击下一步,根据他的选择,页面应该将他重定向到另一个页面 下面是它现在的代码 <fieldset> <legend>Select option</legend> <center> <form method="post" action=""> <inpu

我的表格有问题。我需要它重定向用户到不同的网页根据单选按钮被选中。用户必须从两个选项中选择一个,然后单击下一步,根据他的选择,页面应该将他重定向到另一个页面

下面是它现在的代码

        <fieldset>
        <legend>Select option</legend>

        <center>
        <form method="post" action="">
        <input type="radio" name="radio1" value="Osoba fizyczna"/>Non-company
        </br>
        <input type="radio" name="radio2" value="Firma"/>Company
        </br>
        <input type = "submit", class = "buttonStyle2", value=""/>
        </form>
        </center>
    </fieldset>
非常感谢你的帮助

<fieldset>
    <legend>Select option</legend>
    <center>
    <form method="post" action="">
    <input type="radio" name="radio1" value="Osoba fizyczna"/>Non-company
    </br>
    <input type="radio" name="radio1" value="Firma"/>Company
    </br>
    <input type = "submit" class = "buttonStyle2" value=""/>
    </form>
    </center>
</fieldset>

最好使用允许的值设置一个数组,并检查radio1是否在该数组中。

这里有一种方法可以实现这一点

侧注:确保您没有在页眉之前输出。关于可能已发送的
标题…
,如果发生这种情况,请确保已设置/打开

否则,PHP将无声地失败


Nota:如果该人员没有做出选择,只需单击提交而不进行选择,则该
其他

在表单中使用相同组名的单选按钮时:

<input type="radio" name="radio1" value="Osoba fizyczna"/>Non-company
</br>
<input type="radio" name="radio1" value="Firma"/>Company
非公司

单位

关于

<input type = "submit", class = "buttonStyle2", value=""/>

删除逗号

<input type = "submit" class = "buttonStyle2" value=""/>

因为FF中的HTML源代码将以红色显示属性之间没有空格。

if(isset($\u POST['radio1'])&($\u POST['radio1'])==“Osoba fizyczna”){//redirect}
但将两个单选按钮命名为相同的名称并更改条件。
<input type="radio" name="radio1" value="Osoba fizyczna"/>Non-company
</br>
<input type="radio" name="radio1" value="Firma"/>Company
<input type = "submit", class = "buttonStyle2", value=""/>
<input type = "submit" class = "buttonStyle2" value=""/>