I have created newsletterpopup with two fields, 'email address' and 'subscriber's name'. And I have made input tag for this both field. So now I want to get the subscriber's name in a variable. How can I do that?

  • please mention where you need this values – Vaibhav Ahalpara Nov 25 '16 at 9:41

If you want to get value in controller , You can use -

$data = $this->getRequest()->getPost();
$var = $data['input_field_name'];

Or if you want to get value in your template file than you can get it using following javascript code-

var inputValue = document.getElementById('input_field_id').value;

Probably you want to get input values in controller: You can use below code in your controller(which point your POST action):

$data = $this->getRequest()->getPost();

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.