How do I send a command after submitting a form? I need to do something when the user submits a form so that it sends a command to the server, :
 if($_GET[&quot;cmd&quot;]==&quot;save&quot;)

Got to do something with the thing above,
I thought of using:
&lt;a href=&quot;?cmd=save&quot;&gt;Save&lt;/a&gt;

But if I do that it will not complete the form action so:
&lt;form action=&quot;{{ pageName }}&quot;&gt;

Will not be executed...
So how would I fix this problem?
thanks all :)
The Drupal way to do this is to use hook_form_alter() to add a submit hook, and then add your command in the submit hook.  Here's a simple example.
You'll need to add this code to a custom module.
function MYMODULE_form_alter(&amp;$form, FormStateInterface $form_state, $form_id) {
  if ($form_id == 'my_form_id') {
      $form['actions']['submit']['#submit'][] = 'MYMODULE_my_form_submit';
  }
}

function MYMODULE_my_form_submit(array &amp;$form, FormStateInterface &amp;$form_state) {
  // Insert command here.
}