am using drupal_http_build_query and have part of my code as follows:
$or = db_or();
$or->condition('cid',$fField1);
$or->condition('cid',$fField2);
$or->condition('cid',$fField3);
$or->condition('cid',$fField4);
$or->condition('cid',$fField5);
$or->condition('cid',$fField6);
$or->condition('cid',$fField7);
$or->condition('cid',$fField8);
$querydata = db_select('webform_submitted_data', 'wsd')
->fields('wsd',array('data'))
->condition('nid', $nodeID, '=')
->condition('sid', $sID, '=')
->condition($or)
->execute()
->fetchAll();
$result = array();
$i = 1;
foreach ($querydata as $qvalue) {
$key = 'mapField'.$i;
$result[] = array($$key => $qvalue->data);
$i++;
}
$post_data = drupal_http_build_query($result,'', '&');
When printing the $post_data
variable value, am getting something like this:
name=john&1[address]=street1&2[phone]=123456789
Notice the 1[]
and 2[]
after the &
in the printed value. Any fix to remove these so that I get name=john&address=street1&phone=123456789
?
drupal_http_build_query()
only uses two parameters, not three; since you are using the default value for the second one, you can simply usedrupal_http_build_query($result)
.