Form action not working in zend framework main.phtml file

513 Views Asked by At
**<div>
</div>
<form method='post' action='<?php echo /application/default/controllers/views/certificates.php  ?>'>
<input type='text' id='lon' value='<?php echo $user->login?>'/>
<input type='submit' Name='submit' value='Certificate'/>
    </form>
</div>
</div>**

The above code makes form in the user page, but the form action gives error like, Not found . So please give some answers to solve this and help me to set form action to a .php file in zend framework. I'm using wamp server to run this.

1

There are 1 best solutions below

0
On

aMember route all requests via Front Controller (index.php file). It is not possible to access file /application/default/controllers/views/certificates.php from web directly. I suggest to put your file certificates.php outside of aMember folder. Then you will be able to submit form to it.

Other option is implement custom controller that will handle such form submit. You can put code of your controller to site.php file (http://www.amember.com/docs/Site.php_file).

Here is example of code:

class CertificatesController extends Am_Mvc_Controller {

    function indexAction()
    {
        //handle form submit here
    }
}

Then in form action attribute use this one:

<form method="post" action="<?php p(REL_ROOT_URL . '/certificates') ?>">
  • REL_ROOT_URL - constant that have relative url to your current aMember installation
  • p - function that escape string and output it within template