我有一个正在生成无线电组的课程 . 此类可以选择呈现带有输入类型文本的附加单选按钮 . 问题是,当我使用输入类型文本渲染单选按钮并提交表单时,我将丢失除输入类型文本之外的所有其他无线电的值 . 如果我渲染普通的无线电组没有带输入类型文本的单选按钮,则一切正常 . 这是我的代码示例:

public function render() { 
        $labelClass = $this->_attributes["type"];
        if(!empty($this->inline))
            $labelClass .= " inline";

        $count = 0;
        foreach($this->options as $value => $text) {
            $value = $this->getOptionValue($value);

            echo '<div class="radio"><label class="form-control', $labelClass . '"> <input id="', $this->_attributes["id"], '-', $count, '"', $this->getAttributes(array("id", "value", "checked")), ' value="', $this->filter($value), '"';
            if(isset($this->_attributes["value"]) && $this->_attributes["value"] == $value)
                echo ' checked="checked"';
            echo '/> ', $text, ' </label></div> ';
            ++$count;
                        continue;
        }   
    //from here I generate the additional radio wit input type text
                        if ($this->_hasOtherTextfield == true) {
                            //echo '<div class="radio"><label class="form-control', $labelClass . '"> <input id="', $this->_attributes["id"], '-', $count, '"', $this->getAttributes(array("id", "checked")), ' ';
                        echo '<div class="radio"><label class="form-control', $labelClass . '"> <input id="last" type="radio" name="',$this -> getAttribute("name"),'" value=""  ';
                        if(isset($this->_attributes["value"]) && $this->_attributes["value"] == $value)
                            echo ' checked="checked"';
                        echo '/> ';

                        echo '<input type="text" name="',$this -> getAttribute("name"),'" /></label></div>';

                        }
                        include(__DIR__ . "/LeadTypes.php");
                        $_SESSION[$this -> getAttribute("name").'_id'] = $this -> getAttribute("name");

    }

发现问题, echo '<input type="text" name="',$this -> getAttribute("name"),'" /></label></div>'; 不能与收音机组同名,但现在的问题是,当我提交表单时,输入类型文本将是一个不同的输入,我得到 $_POST 2值而不是一个 .