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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:51:44+00:00 2026-06-09T14:51:44+00:00

If I have this form: form— username email password And I also need to

  • 0

If I have this form:

form—
username
email
password

And I also need to insert an unique ID that is generated.

This code will save the username, email and password in the DB. My question is about the codeLink.

$user_arr = $this->request->data;
$this->User->save($user_arr)

There is another (easy) way, or I should do something like this?

$username = $user_arr['User']['username'];
$email = $user_arr['User']['email'];
$password = $user_arr['User']['password'];
$codeLink = uniqid();

$user_arr = array('User'=>array('username'=>$username, 'email'=>$email, 'password'=>$password, '$code'=>$codeLink));
  • 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-09T14:51:45+00:00Added an answer on June 9, 2026 at 2:51 pm

    You can inject the values into the post data before you pass it to the model like so:

    $this->request->data['User']['codeLink'] = unqueid(); // <-- this line
    $this->User->create($this->request->data);
    if ($this->User->save()) {
    } else {
    }
    

    Things of this sort should be moved to the model, though.

    class User extends AppModel {
    
        public function register($data) {
            $data[$this->alias]['codeLink'] = uniqueid();
            $this->create($data);
            return $this->save();
        }
    
    }
    
    // your controller
    
    if ($this->User->register($this->request->data) {}...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form, in which i need to populate a combo box with
I have this form submit code: Event.observe(window, 'load', init, false); function init() { Event.observe('addressForm',
I have this form <div id=login> <h4>Please log in with your email address</h4> <%=
I have this form that pops up in a modal window like so: <?php
I have this form with a JS function to verify that there are no
I have this form: <div class=row border-tb> <form id=test-form action=/test/insert method=post class=form-inline offset4 span16>
I have this form in my site that uses JavaScript to clear the fields
I have this form that validates the fields on submit through ajax (using Codeigniter's
I have this form in my app and I will submit it via AJAX,
I have this form: <form name=input action=http://s164074194.onlinehome.us/mail.py method=POST> Username: <input type=text name=email /> <input

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.