PHP Admin – How to Submit Action Form in Magento 2

adminmagento2PHP

when i submit form don't submit to acion Save. what wrong.

Source

<div class="edit-slide">
<?php $model = $this->getModelEdit();?>
    <form id="edit_form_slideshow" method="post" action="<?php echo  $this->getUrl('*/*/save'); ?>">
        <input type="text" hidden " name="slideshow_id" value="<?php echo $model -> getId(); ?>">
        <div class="admin__field field field-title  required _required">
            <label class="label admin__field-label"> Name</label>
            <div class="admin__field-control control">
                <input type="text" class="" name="name" value="<?php echo $model -> getName(); ?>">
            </div>      
        </div>
        <div class="admin__field field field-title  required _required">
            <label class="title  admin__field-label"> Create at: </label>
            <label class="create-at"> <?php echo $model -> getCreated_at();  ?></label>
        </div>
        <div class="admin__field field field-title  required _required">
            <label class="title  admin__field-label"> Update at:</label>
            <label class="update-at"> <?php echo $model -> getUpdated_at();  ?></label>
        </div>
        <input type="submit" name="save" value="Save">
        <a href="<?php echo  $this->getUrl('*/*/delete',['_current' => true] ); ?>">Delete</a>

    </form>
</div>

I tested

 <a href=" <?php echo  $this->getUrl('*/*/save'); ?>"> Save </a> is true

I Edited

 <update handle="formkey"/> in layout

Best Answer

For admin form submissions you have to use form_key or else it will not save the data and it'll redirect to the dashboard page.

For Magento 1.x :

<input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />

Thanks to @xanka

Edit:

For Magento 2 :

<input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />

Add this code inside your form.