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


<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 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 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>
        <input type="submit" name="save" value="Save">
        <a href="<?php echo  $this->getUrl('*/*/delete',['_current' => true] ); ?>">Delete</a>


I tested

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

I Edited

 <update handle="formkey"/> in layout
  • what is your action url? – Amit Bera Sep 25 '15 at 7:16
  • namespace Xanka\Slider\Controller\Adminhtml\Slideshow; class Save extends \Xanka\Slider\Controller\Adminhtml\Slideshow – xanka Sep 25 '15 at 7:18

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


For Magento 2 :

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

Add this code inside your form.

| improve this answer | |
  • 1
    Thanks @MeenakshiSundaram R. but in magento2 has to be: <input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" /> – xanka Sep 25 '15 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.