Unable to post form data to controller function

Try with this form

<?php echo $this->Form->create(null, ['url' => ['controller' => 'Pages', 'action' => 'contactus']]); ?>
    <div class="col-md-6">
        <?php echo $this->Form->input('fname', ['placeholder' => 'Your name.' , 'id' => 'fname', 'required' => 'required']); ?>
    </div>
    <div class="col-md-6">
        <?php echo $this->Form->input('mail', ['placeholder' => 'Your email.' , 'id' => 'mail', 'required' => 'required']); ?>
    </div>
    <div class="col-md-6">
        <?php echo $this->Form->input('subject', ['placeholder' => 'Write something.', 'id' => 'subject']); ?>
    </div>

    <div class="col-md-9">
        <?php echo $this->Form->button(__('Submit')); ?>
    </div>         
<?php echo $this->Form->end(); ?>

In your method just try debug($this->request->data);

2 Likes