2016-11-23 24 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]] 
); 

을 그리고 난이 개 라디오 버튼이 : 이제 내가 무엇을 달성하고자하는

<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

아하! 끝내 주셔서 감사합니다! –

관련 문제