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

  • Home
  • SEARCH
  • 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 6037401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:04:07+00:00 2026-05-23T06:04:07+00:00

Allright, lets say I have a User and every user hasMany EmailAddress s. I

  • 0

Allright, lets say I have a User and every user hasMany EmailAddresss.

I have created the following view, to show a single user:

<h2>
    <?php echo $user['User']['username']?>
</h2>
<h3>Addresses</h3>
<table>
    <tr>
        <th>Friends</th>
    </tr>   
<?php foreach ($user['EmailAddress'] as $emailAddress): ?>
    <tr>
        <td><?php echo $emailAddress['address']; ?></td>
    </tr>
<?php endforeach; ?>
</table>

Now I want to create in this User view, an input box, that can add a new EmailAddress associated to that account. 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-05-23T06:04:07+00:00Added an answer on May 23, 2026 at 6:04 am

    Create a form pointing to EmailAddressController/add method

    echo $this->Form->create('EmailAddress');
    //hidden field to indicate which user we are adding the email address to
    echo $this->Form->hidden('user_id', array('value' => $user['User']['id'])); 
    echo $this->Form->input('address');
    echo $this->Form->end('Add');
    

    This PHP should create a FORM that points to your emailaddresses/add controller/action pair. In that Add action, you’ll handle the POST and add the email and redirect back to this page.

    EDIT : Added echos! as @Tim mentioned

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have the following code: public class Collection implements CollectionInterface{ ElementInterface[] elementArray
Alright. Lets say i have a UITextField where a user can input an url
Alright lets say I have a cPlayer class that inherits from cOrganism , which
Alright, let's say that I have the following markup: <div class=ticker> <p>News Item One.
Alright so lets say I have these files in vendor/assets/javascript/ : modernizer.js lightbox.js highchart.js
alright, so lets say i have three tables, as follows : employees( ID ,
Lets say I have a LineItem (from the over used Shopping Cart example) and
All right, let's say I have the following plot. df = data.frame(date=c(rep(2008:2013, by=1)), value=c(303,407,538,696,881,1094))
[Note : I've simplified my example for clarity] Let's say that I have a
Alright, let's say I have these two tables: items with columns id, stuff item_properties

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.