Submit form with PHP cURL, multiple checkboxes with same name -
i trying submit external form using php curl. form fields working fine, except problem have multiple checkboxes same name.
<input type="checkbox" name="same_name" value="value_1"> <input type="checkbox" name="same_name" value="value_2"> <input type="checkbox" name="same_name" value="value_3"> i have no problem passing 1 of checkboxes in curl request. in post string, do:
curl_setopt($ch, curlopt_postfields, '...&same_name=value_1'); but now, want submit form multiple boxes checked. tried suggestion in comments on this stackoverflow post:
curl_setopt($ch, curlopt_postfields, '...&same_name[]=value_1&same_name[]=value_2'); but response based on no checked checkboxes @ all, ergo doesn't work.
basically, how can submit such array correctly in request? can point me in right direction?
if it's form (you can change code), change checkbox's name same_name[]
<input type="checkbox" name="same_name[]" value="value_1"> <input type="checkbox" name="same_name[]" value="value_2"> <input type="checkbox" name="same_name[]" value="value_3"> and call curl_setopt($ch, curlopt_postfields, '...&same_name[]=value_1&same_name[]=value_2');, it's ok.
if it's external - can't have multiple choice.
Comments
Post a Comment