How to post something to database from admin area

xpl0iter

Active member
#1
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?
 

Lawrence

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

Code:
    <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>
    </xen:submitunit>
Will generate this:

Code:
<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>
    </dd></dl>
<input type="hidden" name="_xfToken" value="your_token_value_goes_here_automatically" />
 

xpl0iter

Active member
#4
Code:
<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! :(
 
Top