Entering data into tables


#1

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.


#2

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.


#3

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


#4

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