Hi guys, 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 and submitting it to a mySQL database. All is working fine. I'm just trying to get my head around the getRequest() function.
In the controller, we have this:
public function registerAction()
{
$request = $this->getRequest();
$this->view->assign('action',"process");
$this->view->assign('title','Member Registration');
$this->view->assign('label_fname','First Name');
$this->view->assign('label_lname','Last Name');
$this->view->assign('label_uname','User Name');
$this->view->assign('label_pass','Password');
$this->view->assign('label_submit','Register');
$this->view->assign('description','Please enter this form completely:');
}
and then in view:
<form name="register" method="post" action="<?php echo $this->escape($this->action)?>">
<table>
<tr>
<td><?php echo $this->escape($this->label_fname)?></td>
<td><input type="text" name="first_name"></td>
</tr>
<tr>
<td><?php echo $this->escape($this->label_lname)?></td>
<td><input type="text" name="last_name"></td>
</tr>
<tr>
<td><?php echo $this->escape($this->label_uname)?></td>
<td><input type="text" name="user_name"></td>
</tr>
<tr>
<td><?php echo $this->escape($this->label_pass)?></td>
<td><input type="password" name="password"></td>
</tr>
</table>
<input type="submit" name="submit" value="<?php echo $this->escape($this->label_submit);?>">
</form>
So what I don't understand is why do we need a getRequest() if I already have the method="post" and the action set? If I comment it out, the script doesn'twork. I see it's needed, but I don't understand why-especially since the $request variable doesn't seem to be used?