2016-11-23 47 views
0

私はこのアイテム持ってアクションのラジオボタン入力に応じて、

$sales_payload = array(
    'organization_id' => $organization_id, 
    'contact_id' => $contact_id, 
    'status' => 'Open', 
    'subject' => $_product->post_title." ".str_replace($strToRemove, "", $_POST['billing_myfield12']), 
    'start_date' => date("Y-m-d"), // set start date on today 
    'expected_closing_date' => date("Y-m-d",strtotime(date("Y-m-d")."+ 14 days")), // set expected closing date 2 weeks from now 
    'chance_to_score' => '10%', 
    'expected_revenue' => 0, //set the expected revenue 
    'note' => $_POST['order_comments'], 

    'progress' => array(
    'id'=>'salesprogress:200a53bf6d2bbbfe' //fill a valid salesprogress id to set proper sales progress 
    ), 

    "custom_fields"=> [["actief_in_duitsland"=>1]] 
); 

を、私は2つのラジオボタンがあります。今、私が達成したいものを

<div class="form-row form-row-wide " id="billing_myfield13_field"> 
     <fieldset><legend>Bent u actief in Duitsland?</legend> 
     <label><input type="radio" checked='checked' name="billing_myfield13" value="Ja"/> Ja</label> 
     <label><input type="radio" name="billing_myfield13" value="nee" /> nee</label> 
     </fieldset> 
     </div> 

を'ja'を含むラジオボタンがチェックされているときは、この配列の値は1でなければなりません。

"custom_fields"=> [["actief_in_duitsland"=>1]] 

または値「旧姓」:

"custom_fields"=> [["actief_in_duitsland"=>0]] 

私はどこにでも探していると私は特定の答えを見つけるcouldntの。私は例を得ることができますか、私は正しい方向につながる何かのように。事前に

おかげで、

ケビン

答えて

1

たぶん

<?php 
if(!empty($_POST['billing_myfield13']) && $_POST['billing_myfield13'] ==='ja') { 
    $value = 1; 
}else{ 
    $value = 0; 
} 

$sales_payload = array(
    'organization_id' => $organization_id, 
    'contact_id' => $contact_id, 
    'status' => 'Open', 
    'subject' => $_product->post_title." ".str_replace($strToRemove, "", $_POST['billing_myfield12']), 
    'start_date' => date("Y-m-d"), // set start date on today 
    'expected_closing_date' => date("Y-m-d",strtotime(date("Y-m-d")."+ 14 days")), // set expected closing date 2 weeks from now 
    'chance_to_score' => '10%', 
    'expected_revenue' => 0, //set the expected revenue 
    'note' => $_POST['order_comments'], 

    'progress' => array(
    'id'=>'salesprogress:200a53bf6d2bbbfe' //fill a valid salesprogress id to set proper sales progress 
    ), 

    "custom_fields"=> [["actief_in_duitsland"=> $value]] 
); 
+0

予想外の '{' >>>>であれば(!空($ _ POST [ 'billing_myfield13'])&& $ _POST [ 'billing_myfield13'] === 'ja'){ –

+0

が更新されました。 –

+0

aha!素晴らしい、感謝の仕事! –

関連する問題