PHP multiple radio buttons

后端 未结 3 1566
被撕碎了的回忆
被撕碎了的回忆 2021-01-26 04:24

how can i process all radio buttons from the page?




        
3条回答
  •  鱼传尺愫
    2021-01-26 04:48

    Since the browser will just change all your input to HTTP-formatted form data, you won't be able to tell what data is from a radio button versus a text box or other input.

    If the naming convention is the same as your example, just loop until you don't find a value:

    
    

    EDIT Alternatively, if your form is generated dynamically, you could write the number of radio buttons it created as a hidden field in the form.

    If you are able to alter the form that is being generated, you could write a hidden input that provided a list of all the radio buttons that you want to look for. As you are writing the radio buttons, just make a semi-colon-separated list of all the names that you make. When you are done, write that to a hidden input. Something like this:

    On the source form:

    
    

    Then in your handler:

    
    

提交回复
热议问题