2015-04-03 63 views
0

我想要做的是建立一个形式,如果用户选择选项一个,那么他所显示的选项,其中1和2,但如果他选择选项,他所显示的选项从表单动作PHP和/或MySql创建多个选择?

这将像一个漏斗,导致经过多次选择后的最终结果。

我不知道这是否可以在PHP单独完成,或需要MySql

在代码中调用这个选择过程是什么?

任何教程或建议或示例?

+0

为什么选择MySql?这些选择是否应该来自数据库? – micbobo 2015-04-03 01:43:00

回答

1

我觉得最简单的方法就是使用JQuery。

您可以使用单选按钮等,如下所示:http://www.w3schools.com/html/tryit.asp?filename=tryhtml_radio

确保你给他们,你会在你的JQuery使用ID

这里是你如何更改HTML控件在jQuery的能见度(看看第一个答案):

$('#RadioButtonAID').click(function(){ 
     $('#RadioButton1ID').show(); 
     $('#RadioButton2ID').show(); 
     $('#RadioButtonAID').hide(); 
     $('#RadioButtonBID').hide(); 
    }); 

    $('#RadioButtonBID').click(function(){ 
     $('#RadioButton3ID').show(); 
     $('#RadioButton4ID').show(); 
     $('#RadioButtonAID').hide(); 
     $('#RadioButtonBID').hide(); 
    }); 
012: How to change a text box to visible depending on what item is selected in a drop down menu?

所以,你可以在你的单选按钮前创建的Jquery事件

这将是一个易于使用的方式之间的导航选项选择。

如果您决定包括了jQuery项目去看看这个链接,找出下载/如何将其纳入http://www.w3schools.com/jquery/jquery_get_started.asp

编辑:http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_style_visibility2

这也说明了你一个简单的方法访问你的html控件的可见性