note 108051 deleted from function.curl-init by danbrown

From: Date: Tue, 27 Mar 2012 15:38:04 +0000
Subject: note 108051 deleted from function.curl-init by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-186862@lists.php.net to get a copy of this message
Note Submitter: morfin60 at gmail dot com ---- As i know if you use application/x-www-form-urlencoded then you can post checkboxes array(with names like "mycheckbox[]") with query string like that: <?php $postFields="sometextfield=sometextvalue&somecheckbox[1]=1&somecheckbox[2]=3&somecheckbox[3]=7"; ?> but if you use multipart/form-data(and pass array as third parameter) you can do something like that to do that: <?php ... $postFields = array( "sometextfield" => "sometextvalue", "somecheckbox[1]" => "1", "somecheckbox[2]" => "4", "somecheckbox[5]" => "6" ); curl_setopt($curl,CURLOPT_POSTFIELDS,$postFields); ... ?> that will send one dimension array but receiveing script will get multidimensional array like that: Array ( [sometextfield] => sometextvalue [somecheckbox] => Array ( [1] => 1 [2] => 4 [5] => 6 ) )

« previous php.notes (#186862) next »