Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8334083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:14:06+00:00 2026-06-09T03:14:06+00:00

I have a Zend view in PHP with a form: <form action=https://example.com/checkout/ name=info method=post>

  • 0

I have a Zend view in PHP with a form:

<form action="https://example.com/checkout/" name="info" method="post"> 
    <div id="payment">
        <div id="paypal>
            <?php $this->is_paypal_payment = true; ?>
        </div>
        <div id="credit_card>
            <?php $this->is_paypal_payment = false; ?>
        </div>
    </div>
</form>

When a user clicks the submit button, how can I set the instance variable in the Controller?

This is what I tried which didn’t work.

Controller:

$this->view->payment_option_paypal = false;  // initialized value

$payment_method_option = $this->_getParam('payment_option_paypal', null);
if (!is_null($payment_method_option)) {
   if ($payment_method_option == 'paypal') {
       $this->_is_paypal = true;
   }
}

View:

<div id="paypal" style="display: none;">
    <?php $this->payment_option_paypal = "paypal"; ?>
    <img src="paypal.gif" style="margin-right:20px;">
</div>

After clicking submit, the _getParam() function doesn’t capture the string “paypal” that the view set for instance variable in Controller $this->payment_option_paypal

Any ideas what’s wrong and how to go about this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:14:08+00:00Added an answer on June 9, 2026 at 3:14 am

    in you phtml page you have to use like this

    <div id="paypal" style="display: none;">
        <input type="hidden" name="paypalname" value="<?php echo $this->payment_option_paypal = "paypal"; ?>" id="paypalname"/>
        <img src="paypal.gif" style="margin-right:20px;">
    </div>
    

    and the controller

    function yourAction()
    {
          if ($this->_request->isPost()) 
          {
             $paypalvalue=$this->_getParam('paypalname');
          }
    }
    

    I hope it helps you and if you have any problem in my answer then let me know.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Form element: $Form=new Zend_Form; $Form->setAction($this->view->url(array('controller'=>'auth','action'=>'create'),null,true)) ->setMethod('post') ->setAttrib('id','auth-form') ->removeAttrib('enctype'); As can be
I'm reading the manual here: http://zendframework.com/manual/en/zend.view.helpers.html but I'm still confused. I have a script
I have tried to embed a flash movie in a zend view using the
I'm doing this tutorial: http://www.phpeveryday.com/articles/Zend-Framework-Database-Creating-Input-Form-P494.html We are building a simple input form using POST
I have created this file at My/View/Helper/FormElement.php <?php abstract class My_View_Helper_FormElement extends Zend_View_Helper_FormElement {
I have Zend_Form empty values problem: My View: I print only part of form
i have used zend pagination in my controller action.it returns zend paginator object that
I'am doing this: http://zend-framework-community.634137.n4.nabble.com/How-to-Zend-Dojo-Form-Dependent-Selects-e-g-Country-City-td663650.html If i do this: $this->view->form->getElement('subtipo')->setStoreParams(array('url' => 'http://localhost/~xpete/project/public/info/lookup/tipo/1')); I get this
I have the following code in my zf2 controller: <?php namespace Accounting\Controller; use Zend\Mvc\Controller\ActionController,
I have Login.php form like this: class Form_Login extends Zend_Form { public function init()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.