2017-08-08 6 views
0

私のPHPでラジオボタンがチェックされていますが、なんらかの理由で何の価値もありません。他の誰かが私が間違っている場所を見ていますか?フォームは、いくつかの検証後にjavascriptを介して提出されます。私は必要に応じてそのコードを提供することができます。ラジオボタンの空白値の取得

ボタンのグループHTML:

<!-- Start Purchase Radio --> 
    <div class="form-group"> 
     <div class="radio"> 
      <label> 
       <input type="radio" name="transType" id="transTypePurchase" value="purchase"> 
       Purchase 
      </label> 
     </div> 
    </div> 
<!-- End Purchase Radio --> 

<!-- Start Refinance Radio --> 
    <div class="form-group"> 
     <div class="radio"> 
      <label> 
       <input type="radio" name="transType" id="transTypeRefinance" value="refinance"> 
       Refinance 
      </label> 
     </div> 
    </div> 
<!-- End Refinance Radio --> 

<!-- Start Transfer Radio --> 
    <div class="form-group"> 
     <div class="radio"> 
      <label> 
       <input type="radio" name="transType" id="transTypeTransfer" value="transfer"> 
       Transfer 
      </label> 
     </div> 
    </div> 
<!-- End Transfer Radio --> 

<!-- Start Other Radio --> 
    <div class="form-group"> 
     <div class="input-group"> 
      <span class="input-group-addon"> 
       <input type="radio" aria-label="Radio button for following text input" name="transType" id="transTypeOther"> 
      </span> 
      <input type="text" class="form-control" aria-label="Text input with radio button" name="transType" id="transcationOtherText" onfocus="otherTextBox(transcationOtherText);" placeholder="Other"> 
     </div> 
    </div> 
<!-- End Other Radio --> 

はPHP:

if(isset($_POST['transType'])) { 
    $value = $_POST['transType']; 
    echo "*" . $value . "*"; 
} 
+0

同じ名前のテキスト入力の内容は何ですか?私はそれがその名前のページの最後の要素であるので、入力ボックスの内容を常に使用すると信じています。 – GrumpyCrouton

+1

'print_r($ _ POST);'には他のキー/値がありますか? – Rasclatt

+0

お返事ありがとうございました!答えは以下の通りです。私の「他の」テキストフィールドの名前は、ラジオと同じです。私がそれを変更したら、私は無線の価値を得ました。 –

答えて

2

あなたは、テキスト入力のための無線入力と同じ名前を持ちます。

<input type="text" class="form-control" aria-label="Text input with radio button" name="transType" id="transcationOtherText" onfocus="otherTextBox(transcationOtherText);" placeholder="Other"> 

上記の入力の名前を変更してください。

+0

それはそれだった...それを理解しようと2時間を費やした。タイマーがアップしているときに正しい答えとしてマークします。ありがとうございました。 –

関連する問題