使用Zend \ Form \ Form构建一个新表单

时间:2014-07-13 18:02:26

标签: php zend-framework2

我正在尝试构建一个新的表单来将用户帐户添加到网络应用程序中并实现我尝试通过Zend \ Form \ Form执行此操作。我如何使用Zend \ Form \ Form:

编写此html代码
<form method="post" action="./ajouter">

    <div class="form-group">
        <label for="identifiant">Identifiant</label>
        <input type="text" class="form-control" name="identifiant" id="identifiant" value="" placeholder="Entrez l'identifiant" />
    </div>
    <div class="form-group">
        <label for="motDePasse">Mot-de-passe</label>
        <input type="password" class="form-control" name="motDePasse" id="motDePasse" value="" placeholder="Entrez le mot-de-passe" />
    </div>
    <div class="form-group">
        <label for="role">Rôle</label>
        <select class="form-control" name="role" id="role">
            <option value="administrateur" selected>Administrateur</option>
            <option value="membre">Membre</option>
        </select>
    </div>
    <button type="submit" class="btn btn-primary">Ajouter</button><a href="../compte" style="margin-left:5px;">Retourner à la liste</a>
</form>

这是一个可以从以下开始的骨架:

<?php
namespace Application\Form;

use Zend\Form\Form;

class AddAccountForm extends Form{

    public function __construct(){
        parent::__construct();

        $this->setName('adduser');
        $this->setAttribute('method', 'post');

    }
}

?>

非常感谢!

0 个答案:

没有答案
相关问题