Don’t forget your XID!
Having just spent over an hour trying to work out why my Module Control Panel forms weren’t submitting correctly, I thought I’d document the fix here (for my purposes and yours).
The error I was seeing was that when submitting my control panel form, rather than posting to my module function, the form was redirecting back to the ExpressionEngine control panel homepage. The reason for this? I had forgotten to include the XID secure form hidden post variable.
Wrong
<form method="post" action="<?=$base_url?>&method=save"> ...blah <input type="submit" name="Save"/> </form>
Right
<form method="post" action="<?=$base_url?>&method=save"> <input type="hidden" name="XID" value="<?=XID_SECURE_HASH?>" /> blah <input type="submit" name="Save"/> </form>