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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:49:08+00:00 2026-06-10T17:49:08+00:00

I already created a register form. I have 3 select-boxes. Day, Month, Year. In

  • 0

I already created a register form.
I have 3 select-boxes. Day, Month, Year.
In my database I have one column called “Birthday” with the format of “date”.
Now I want to put all three together and insert the result into the database.

public function beforeSave($options = array()){
    $this->data['User']['Birthday'] = $this->data['User']['Year'] . '-' . $this->data['User']['Month'] .'-' . $this->data['User']['Day'];
    return true;
}

But this is not working 🙁

None of this fields (Day, Month,Year, Birthday) has validation rules..

How can I do this?

  • 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-06-10T17:49:09+00:00Added an answer on June 10, 2026 at 5:49 pm

    You can try the following code in your Model:

    public function beforeSave($options = array()){
       if(!empty($this->data)){
           //pr($this->data);die;
           $this->data['User']['Birthday'] = date('Y-m-d', strtotime($this->data['User']['Year'] . '-' . $this->data['User']['Month'] .'-' . $this->data['User']['Day']));
          unset($this->data['User']['Year']);
          unset($this->data['User']['Month']);
          unset($this->data['User']['Day']);
       }
       return true;   
    }
    

    There must be following form fields should be available into your form:

    <?php echo $this->Form->create('User', array('url' => $this->params));
          echo $this->Form->input('Year', array('options' => $year_options, 'type' => 'select'));
          echo $this->Form->input('Month', array('options' => $month_options, 'type' => 'select'));
          echo $this->Form->input('Day', array('options' => $day_options, 'type' => 'select'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a register form, that puts users in the database and auto
I have two User Controls already created now I want to use one as
I have already created my application on web socket with ASP.net 4.0. I just
I have already created a webpart to show the data from list, but I
I'm have a form set up which allows users to register with our mobile
Specifically, I have a form for creating a User . One of the fields
i have two tables which form part of my login/register system: these are userlogin
Suppose I have a application form which contain lot of boxes like email,username,age etc...I
I have a Django form that will add an entry to a database with
I have a web-page application already created, but when I open it in visual

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.