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 648231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:48:34+00:00 2026-05-13T21:48:34+00:00

My form class: <?php require_once (‘Zend\Form.php’); class Sergio_Form_registrationform extends Zend_Form { public function init(){

  • 0

My form class:

<?php

require_once ('Zend\Form.php');

class Sergio_Form_registrationform extends Zend_Form {
    public function init(){     
        /*********************USERNAME**********************/
        $username = new Zend_Form_Element_Text('username');
        $alnumValidator = new Zend_Validate_Alnum();

        $username   ->setRequired(true)
                    ->setLabel('Username:')
                    ->addFilter('StringToLower')
                    ->addValidator('alnum')
                    ->addValidator('regex', false, array('/^[a-z]+/'))
                    ->addValidator('stringLength',false,array(6,20));
        $this->addElement($username);

        /*********************EMAIL**********************/
        $email = new Zend_Form_Element_Text('email');
        $alnumValidator = new Zend_Validate_Alnum();


        $email      ->setRequired(true)
                    ->setLabel('EMail:')
                    ->addFilter('StringToLower')
                    ->addValidator('alnum')
                    ->addValidator('regex', false, array('/^[a-z]+/'))
                    ->addValidator('stringLength',false,array(6,20));
        $this->addElement($email);

        /*********************PASSWORD**********************/
        $password = new Zend_Form_Element_Password('password');
        $alnumValidator = new Zend_Validate_Alnum();


        $password   ->setRequired(true)
                    ->setLabel('Password:')
                    ->addFilter('StringToLower')
                    ->addValidator('alnum')
                    ->addValidator('regex', false, array('/^[a-z]+/'))
                    ->addValidator('stringLength',false,array(6,20));
        $this->addElement($password);

        /*********************NAME**********************/
        $name = new Zend_Form_Element_Text('name');
        $alnumValidator = new Zend_Validate_Alnum();


        $name       ->setRequired(true)
                    ->setLabel('Name:')
                    ->addFilter('StringToLower')
                    ->addValidator('alnum')
                    ->addValidator('regex', false, array('/^[a-z]+/'))
                    ->addValidator('stringLength',false,array(6,20));
        $this->addElement($name);

        /*********************LASTNAME**********************/
        $lastname = new Zend_Form_Element_Text('lastname');
        $alnumValidator = new Zend_Validate_Alnum();


        $lastname   ->setRequired(true)
                    ->setLabel('Last Name:')
                    ->addFilter('StringToLower')
                    ->addValidator('alnum')
                    ->addValidator('regex', false, array('/^[a-z]+/'))
                    ->addValidator('stringLength',false,array(6,20));
        $this->addElement($lastname);

        /*********************DATEOFBIRTH**********************/
        $dateofbirth = new Zend_Form_Element_Text('dateofbirth');
        $alnumValidator = new Zend_Validate_Alnum();


        $dateofbirth->setRequired(true)
                    ->setLabel('Date of Birth:')
                    ->addFilter('StringToLower')
                    ->addValidator('alnum')
                    ->addValidator('regex', false, array('/^[a-z]+/'))
                    ->addValidator('stringLength',false,array(6,20));
        $this->addElement($dateofbirth);

        /*********************AVATAR**********************/
        $avatar = new Zend_Form_Element_File('avatar');
        $alnumValidator = new Zend_Validate_Alnum();


        $avatar     ->setRequired(true)
                    ->setLabel('Please select a display picture:');
        $this->addElement($avatar);

        /*********************SUBMIT**********************/

        $this->addElement('submit', 'login', array('label' => 'Login'));
    }
}
?>

And here I’m saving things:

<?php

require_once ('Zend\Controller\Action.php');

class RegistrationController extends Zend_Controller_Action {
    //For each of these methods, you MUST have another phtml file in the respective View folder.
    public function indexAction(){
        $form = new Sergio_Form_registrationform();
        $this->view->form = $form;
    }

    public function init(){
        $this->_setParam('db',Zend_Db_Table_Abstract::getDefaultAdapter());
    }

    public function saveforminformationAction(){
        $form = new Sergio_Form_registrationform();
        $request = $this->getRequest();

        //if($request->isPost() && $form->isValid($_POST)){         
            $data = $form->getValues();
            unset($data['login']);
            $db = $this->_getParam('db');

            $db->insert('user',$data);          
        //}     
    }
}

?>

And here’s a screenshot of how things are being saved:

alt text

What am I doing wrong? Not even the dates I write are being saved.

Here’s the table structure:

alt text

  • 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-05-13T21:48:34+00:00Added an answer on May 13, 2026 at 9:48 pm

    You are not setting the POST’ed values to the Form.

    Either uncomment the line with

    $form->isValid($_POST)
    

    or call

    $form->populate($_POST)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my Zend code: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form { public function
Here's what I'd like: Here's my code: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form
<?php require_once('inc/dbc1.php'); $pdo = new PDO('mysql:host=###;dbname=#####', $username, $password); $pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $sth =
I need to use Zend Captcha and wrote the follwoing code: <?php require_once ('Zend/Form.php');
edit/operacoes.php header('Content-Type: application/json'); include('../../lib/mysql.class.php'); $db = new MySQL(); if($db->Error()) $db->Kill(); //VARIÁVEIS DA FORM $id
I have a Form class partial class ProgressMainForm : Form { public ProgressMainForm() {
I have created a php person class and a very basic form. The form
I have the following code written, <?php require_once products.php; $test = new Products; $array
The dbcred.php class <?php # pdo_testdb_connect.php - function for connecting to the test database
in my php script at the top i have require_once('../registration/include/membersite_config.php'); wich is a class

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.