How to post something to database from admin area


Active member
I would like to create an addon which will be able to post something to database from the admin area.
I have the db query, but don't have any idea how I could achieve this! I have a text area and a submit button, but when I submit the data, it gives me a security error. Can somebody please help me?


Well-known member
It seems like you are missing the token. If you use the xen:submitunit it ads the token automatically for you, for example:

    <xen:submitunit save="{xen:phrase iwdrp_save_roster}">
        <xen:if is="{$roster.roster_id}"><a href="{xen:adminlink 'iwdrp-roster/delete', $roster}" class="button OverlayTrigger">{xen:phrase iwdrp_delete_roster}...</a></xen:if>
Will generate this:

<input type="submit" value="Save Roster" class="button primary" accesskey="s" />
        <a href="admin.php?iwdrp-roster/staff.2/delete" class="button OverlayTrigger">Delete Roster...</a>
<input type="hidden" name="_xfToken" value="your_token_value_goes_here_automatically" />


Active member
<textarea name="foo_bar" rows="4" cols="50">
</textarea><br />
<xen:submitunit save="Submit">
<a href="{xen:adminlink 'foobar/write', 1}" class="button OverlayTrigger">Submit</a></xen:if>
</xen:submitunit><br />
This is giving me 2 submit buttons., in which one is not working! :(