Insert radio button value to mysql

后端 未结 3 1173
傲寒
傲寒 2021-01-07 08:32

I have created a test form just to try to send my radio button value to mysql. I am having problems with it at the moment. The code below is just a test, I want the radio bu

3条回答
  •  礼貌的吻别
    2021-01-07 08:43

    You should start with closing all of your tags with or at least a slash at the end (like ).

    You should set values to your radios (like this they always return 'on'), whereas the submit button needs neither name nor value.

    EDIT:

    Define a default radio with selected in yout input tag! If none is selected, there's no case getting transmitted and PHP will throw Undefined index: case when accessing $_POST['case'].

    A good way to prevent such errors is to check if all necessary indices are set. You can do the following:

    if(isset($_POST['name']) and isset($_POST['case']) and isset($_POST['email'])) { ... }
    

提交回复
热议问题