# Entering data into tables

**URL:** <https://discourse.cakephp.org/t/entering-data-into-tables/3772>\
**Category:** Need Help\
**Created:** [January 17, 2018, 6:20pm UTC](https://discourse.cakephp.org/t/entering-data-into-tables/3772 "2018-01-17T18:20:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kickoff3pm](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kickoff3pm/32/898_2.png) [@kickoff3pm](https://discourse.cakephp.org/u/kickoff3pm)\
**Post date:** [January 17, 2018, 6:20pm UTC](https://discourse.cakephp.org/t/entering-data-into-tables/3772/1 "2018-01-17T18:20:58Z")

</div>

So I have two tables, one table has a foreign key from the other.

When I create the form I don’t want to just select this data I want to be able to add to the data too. I don’t have a clue how to do this type of thing.

---

<div class="post-metadata">

**Author:** ![baruch.wolf](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/baruch.wolf/32/915_2.png) [@baruch.wolf](https://discourse.cakephp.org/u/baruch.wolf)\
**Post date:** [January 19, 2018, 6:01am UTC](https://discourse.cakephp.org/t/entering-data-into-tables/3772/2 "2018-01-19T06:01:38Z")

</div>

It would help to be a little more specific about your issue; but I think you mean the data that gets loaded into the form whenever you pass an entity to the form creator method:

\<?php echo $this-\>Form-\>create($article, array()); ?\>

Which you would avoid by passing null as the first parameter:

\<?php echo $this-\>Form-\>create(null, array()); ?\>

Please let me know if it helps.

---

<div class="post-metadata">

**Author:** ![kickoff3pm](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kickoff3pm/32/898_2.png) [@kickoff3pm](https://discourse.cakephp.org/u/kickoff3pm)\
**Post date:** [January 19, 2018, 12:41pm UTC](https://discourse.cakephp.org/t/entering-data-into-tables/3772/3 "2018-01-19T12:41:16Z")

</div>

Here’s an example - In the form you are requested to enter the name of an actor.

If you consider most forms you fill in on the internet. You click the edit box and a list drops down allowing you to select from a number of choices. You can also enter a letter lets say “R” and the choices are narrowed down to those beginning with letter “R”. Add a second “Ro” and your choice are narrowed further. But if you get to “Robert Downey” and this name is not already in the database when you submit the form “Robert Downey” is added to the “actors” table.

In my case the “actor” field would be a foreign key in the “films” table

---

<div class="post-metadata">

**Author:** ![kickoff3pm](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kickoff3pm/32/898_2.png) [@kickoff3pm](https://discourse.cakephp.org/u/kickoff3pm)\
**Post date:** [January 22, 2018, 2:09pm UTC](https://discourse.cakephp.org/t/entering-data-into-tables/3772/4 "2018-01-22T14:09:17Z")

</div>

Well that’s my interest in Cakephp ended. Back to Wordpress it is then.
