How to use the "reference"element in database?

Hello, hope you guys are all well…

I need your help with my app. I have a feature that allows the users to create notes (like a diary) and they create also folders. When they create notes they must associate that note to a folder that they have create previously.

I can’t associate the notes to the folders. I’ll show what i’ve done in my app for better understanding.

  1. Created a table in data base: “Folder”
  2. Created a table in data base: “Notes”
  3. Inside “Notes” i’ve created a field called “Folders” with type “Reference” appointing to “Folder” table.
  4. Then in design i have a form to users create the notes and a select element to choose the folder.

Can someone help me? I am doing anything wrong?

When i try to submit my form it says that it is invalid.

If you need other prints, tell me.

Thanks, Rodrigo!

In general you should really avoid having spaces in database names. Always use underscores instead of spaces.

The same is valid for your form fields. Now you have spaces there as well and probably the wrong data gets submitted to the server. So you have to double check the form data and the $_POST definitions in the server connect if they match