Custom form with custom submit I'm building a custom form that will show some details from a web service.

On my page callback I have two fields and submit button:

&lt;?php

$form['starting_date'] = array(
   '#type' =&gt; 'date_popup',
   '#title' =&gt; 'Starting date',
   '#date_format' =&gt; 'd.m.Y',
);

$form['end_date'] = array(
   '#type' =&gt; 'date_popup',
   '#title' =&gt; 'End date',
   '#date_format' =&gt; 'd.m.Y',
);

$form['submit'] = array(
   '#type' =&gt; 'submit',
   '#value' =&gt; t('Check'),
   '#submit' =&gt; array('reports_list'),
);


On

&lt;?php
function reports_list($form, &amp;$form_state) {

}


I'm inserting the code that connects with the web service, passing the form_state values of selected dates and after that I'm trying to display the table with the web service details on the same page, but after clicking on submit it simply refresh the page and doesn't show anything.

I can see connecting with the web service is successful. 

On custom submit function this for an example is not displaying:

&lt;?php

$form['results'] = array(
   '#type' =&gt; 'markup',
   '#markup' =&gt; '&lt;p&gt;TEST&lt;/p&gt;',
);


I'm doing something wrong, I guess...

EDIT: I've tried to display something in the submit function like this:

&lt;?php

$form['results'] = array(
   '#type' =&gt; 'markup',
   'markup' =&gt; 'TEST10',
);

echo render($form['results']);


It's not working.
I think your problem is due to a misunderstanding of how Drupal forms work.

Drupal uses the PRG pattern for form submissions. That means for you, that you can't set form elements in the submit handler.

You can either set a message using drupal_set_message() which will be displayed on the next page.

Or you can instruct the form to rebuild, which will result in a redirect to the same form page that you came from with your form builder being called again. In the form builder function you can then check if the form has previously been submitted and then build the form accordingly. This second option is usually referred to as a multistep form. Have a look at this blog post for an example: http://davidsonj.com/blog/how-create-multi-step-form-drupal-7