Custom Block form post

Permalink
Hi,

I have a custom block which contains a form.
I need this form to post to an action in the controller. I have used the same code as a custom single page, but it wont post to the controller action..? Any guidance appreciated.

<-- Code from view.php -->
<form method="post" action="<?php  echo $this->action('signup')?>" class="form-inline"> 
       <label class="checkbox">Email:</label>
        <input type="text" class="input" name="email">
        <button type="submit" class="btn">Continue</button>
   </form>
<-- Code from controller.php -->
<?php defined('C5_EXECUTE') or die(_("Access Denied."));
class EmailSignupBlockController extends BlockController {
   protected $btInterfaceWidth = "500";
   protected $btInterfaceHeight = "350";
   public function getBlockTypeName() {
      return t('Email Sign Up');
   }
   public function getBlockTypeDescription() {

 
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
I am not sure if this will work, but you could try something like:
public function action_signup($email) {
  echo $email;
  ...
}


or

public function action_signup() {
  echo $_POST['email'];
  ...
}


Unlike single pages, actions in blocks need to have the prefix.
obaudains replied on at Permalink Reply
Great it worked. than you.

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.