How to display external data using custom form in a Drupal page? I have created a form custom module for get data from an external url. 

$requestType = drupal_http_request('http://www.example.in/php/example/getSampleType.php',$options);
$loomType =drupal_json_decode($requestType-&gt;data);


This is my Form


Using this result I have created checkboxes and select a value from checkbox then submit the data.

function myForm_form_submit($form, &amp;$form_state) {


$form_state['rebuild'] = TRUE;
$url='http://www.example.in/php/example/exampleSort.php';
//$data1 = http_build_query($form_state['values']['check'], '', '&amp;');

$checked = array();
foreach($form_state['values']['check'] as $key =&gt; $val) {
array_push($checked, $val);
  }
$mychecked=checking($checked);

$checkedType = array();
foreach($form_state['values']['checktype'] as $key =&gt; $val) {
array_push($checkedType, $val);
  }
$loomType=checking($checkedType);

$datas=array("sampleMachine"=&gt;$mychecked, "sampleType"=&gt; $loomType);
$data =json_encode($datas);
$option = array(
            'method' =&gt; 'POST',
            'data' =&gt; $data,
            'headers' =&gt; array('Content-Type' =&gt; 'application/json'),
    );
//$headers = array('Content-Type' =&gt; 'application/json');

$response =drupal_http_request($url,$option);

echo "&lt;pre&gt;";
print_r($response);
echo "&lt;/pre&gt;";


}

I got some result. Now I want to display those results in my drupal page. How can I do that..I am using Drupal 7.

I want to display this in Drupal page in specific format
Not sure why you want to create a custom module for this, since ... there is a module that can "*display JSON results in a Drupal page" ... i.e. the Views JSON Query module. Some details from its project page:


  JSON Query is a Views 3 plugin that adds native JSON query generation. It allows you to parse JSON using Views' graphical query builder.
  It works much like Views XML Backend but with JSON.


And a screenprint from that same page:



For more details, read about it in the article about "Show external JSON data in Drupal Views".

PS: Similar solution if your input format is XML (instead of JSON), using Views XML Backend.