This is my view file called application.html
.
I just started learning the Zend framework.
I have existing database table (mytable.sql
), with three columns:
ID
APP_ID
APP_NAME
So now my goal is, I need create new app using post method and that new app name must be save in to database.
<form method="post" action="/admin/appmgt/createAction">
<p>
<label class="field" for="APP_ID"><span>*</span>APP_ID</label>
<input type="text" name="APP_ID" class="textbox-300" />
</p>
<p>
<label class="field" for="APP_NAME"><span>*</span>APP_NAME</label>
<input type="text" name="APP_NAME" class="textbox-300" />
</p>
<input type='submit' name='submit' value='Submit Form' />
</form>
This my controller file:
public function createAction() {
$this->view->form = $this->getForm();
if ($this->getRequest()->isPost()) {
if (!$this->view->form->isValid($_POST)) {
return $this->render('form');
}
}
}
This is my Model file:
public function createApp($APP_ID, $APP_NAME) {
$data = array(
'APP_ID' => $APP_ID,
'APP_NAME' => $$APP_NAME
);
$this->insert($data);
}
Could you please help me ?