フォームにチェックボックスがあり、php フォーム プロセッサに投稿しています。私のフォーム プロセッサは、get 要求を Web サービスに送信します。リクエストには、この ?services=Chin&services=Neck&services=Back&location=5 のような各チェック ボックスが必要です。
キー値はありませんが、私のphpコードでは、各サービスの後に[]を出力しています。
//build query string
$fields = array('services' => $services,
'location' => $location,
'firstname' => $firstname,
'lastname' => $lastname,
'email' => $email,
'emailconfirm' => $email,
'phone' => $telephone,
'comments' => $message);
$url = "fakewebaddress?" . http_build_query($fields, '', "&");
//send email if all is ok
if($formok){
$curl_handle = curl_init($url);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
$results = curl_exec($curl_handle);
curl_close($curl_handle);
}
私のhtmlボックスは次のようになります
<input type="checkbox" name="services[]" value="Leg" />
<input type="checkbox" name="services[]" value="Chest" />
<input type="checkbox" name="services[]" value="Neck" />
<input type="checkbox" name="services[]" value="Back" />
必要な出力を得るにはどうすれば修正できますか?