Php 插入单选按钮的值

Php 插入单选按钮的值,php,html,mysql,radio-button,Php,Html,Mysql,Radio Button,我试图在将单选按钮签入mysql db表时插入其值。下面是进行此操作的HTML和PHP。请告诉我出了什么问题 以下是第一个HTML: 我认为这是一个逻辑错误。您应该只在数据库的单选按钮中保存一个变量 我认为这是一个逻辑错误。您应该只在数据库的单选按钮中保存一个变量 看到了吗,这与我的要求不太接近。提交后,数据库中是否没有显示这两个无线电值?正确的sbeliv01,无论是否选中,这些值都不会进入数据库。不过,没有为无线电字段定义变量。对不起,耽误了你的时间。感谢您的帮助。这与我的要求还不太接近。提

我试图在将单选按钮签入mysql db表时插入其值。下面是进行此操作的HTML和PHP。请告诉我出了什么问题

以下是第一个HTML:


我认为这是一个逻辑错误。您应该只在数据库的单选按钮中保存一个变量


我认为这是一个逻辑错误。您应该只在数据库的单选按钮中保存一个变量


看到了吗,这与我的要求不太接近。提交后,数据库中是否没有显示这两个无线电值?正确的sbeliv01,无论是否选中,这些值都不会进入数据库。不过,没有为无线电字段定义变量。对不起,耽误了你的时间。感谢您的帮助。这与我的要求还不太接近。提交后,数据库中是否没有显示这两个无线电值?请更正sbeliv01,无论是否选中,这些值都不会进入数据库。不过,没有为无线电字段定义变量。对不起,耽误了你的时间。谢谢你的帮助
<div class='container'>
    <label for='username' >Business*:</label><br/>
    <input type="radio" name="bus" id="username" value="bus" maxlength="50" /><br/>
    <span id='register_username_errorloc' class='error'></span>
</div>
<div class='container'>
    <label for='username' >Personal*:</label><br/>
    <input type="radio" name="pers" id="username" value="per" maxlength="50" /><br/>
    <span id='register_username_errorloc' class='error'></span>
</div>
function InsertIntoDB(&$formvars)
    {

        $confirmcode = $this->MakeConfirmationMd5($formvars['email']);

        $formvars['confirmcode'] = $confirmcode;

        $insert_query = 'insert into '.$this->tablename.'(
                name,
                email,
                username,
                password,
                confirmcode,
                dob,
                business,
                personal
                )
                values
                (
                "' . $this->SanitizeForSQL($formvars['name']) . '",
                "' . $this->SanitizeForSQL($formvars['email']) . '",
                "' . $this->SanitizeForSQL($formvars['username']) . '",
                "' . md5($formvars['password']) . '",
                "' . $confirmcode . '",
                "' . $this->SanitizeForSQL($formvars['dob']) . '",
                "' . $this->SanitizeForSQL($formvars['bus']) . '",
                "' . $this->SanitizeForSQL($formvars['pers']) . '"
                )';      
        if(!mysql_query( $insert_query ,$this->connection))
        {
            $this->HandleDBError("Error inserting data to the table\nquery:$insert_query");
            return false;
        }        
        return true;
    }
            "' . $this->SanitizeForSQL($formvars['bus']) . '",
           "' . $this->SanitizeForSQL($formvars['pers']) . '"