I'm working on a legacy Magento site which has a custom contact form modelled on https://inchoo.net/magento/magento-email/magento-custom-email-contact-form-with-notification-system/. At some point in the past few months, this has stopped working. In those few months, the site has had update patches and has been moved to a new server.

Here is a snippet of the phtml form:

<form id="form-validate" name="simple_contact_form" action="<?php echo $this->getUrl('company-companycontact/') ?>index/sendemail" class="f-form" method="post">
        <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />

        <div class="fieldset">
        <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
        <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
        <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
        <ul class="form-list">
            <li class="fields">
                <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>

                <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                    <div class="input-box">
                        <input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />

    <div class="buttons-set">

                    <button type="submit" title="<?php echo $this->__('Submit') ?>" class="f-btn f-float-right"><span><span><?php echo $this->__('Submit') ?></span></span></button>

            <script type="text/javascript">
                var dataForm = new VarienForm('form-validate', true);
                <?php if($this->getShowAddressFields()): ?>
                new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
                <?php endif; ?>

And a snippet of the controller (I've removed the email processing logic, be rest assured that all works).

class Company_CompanyContact_IndexController extends 
 public function indexAction()
    //Get current layout state

    $block = $this->getLayout()->createBlock(
            'template' => 'contacts/trade_registration.phtml'

    //$this->getLayout()->getBlock('right')->insert($block, 'catalog.compare.sidebar', true);



public function sendemailAction()
    //Fetch submited params
    $params = $this->getRequest()->getParams();
    Mage::log($params, null, 'trade.log', true);

            $formInfo = "";
            $formInfo .= "<strong>First Name:</strong> " . $params['firstname'] . "<br>";
            $formInfo .= "<strong>Surname:</strong> " . $params['lastname'] . "<br>";
            $formInfo .= "<strong>Email</strong>: " . $params['email'] . "<br>";



When I try to dump the $params in a log, I just get and empty array. Equally, if I try $this->getRequest()->getParam('firstname') or Mage::app()->getRequest()->getParam('firstname');, both values return null.

Did anything change in recent patches or PHP7 which could break this function?


Your Answer

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

Browse other questions tagged or ask your own question.