Form action in CMP

I am creating a newsletter generator in CMP. I get a list of news (resource from CMS), create a form with a list of choices and I want the form to return to CMP after pressing the “Generate” button. However, when I enter the address in the form action I have in CMS Modx, after submitting the form it redirects me to another page, why?

My snippet:

...
$output .= '<form action="https://website.com/manager/?a=generate-mail&namespace=newsletter">
  <label for="s1">Select</label>
  <select name="s1" id="s1">
    '.$option.'
  </select>
  <input type="submit" value="Generate">
</form>';
echo  $output;

And redirects:
https://website.com/manager/?s1=18

try to use post as the form method or put a and namespace as hidden fields to your form and usually, you don’t need the host and domain in the form action.

1 Like

Thank you, I did as you wrote, it works!
<form method="POST">

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.