0

I'm using Grocery CRUD with CodeIgniter, and I have this table :

annonce (id, name, id_user).

the id_user is a foreign key which references to another table user(id,....).

I don't want to add the user_id in an input when I add an entry in the annonce table, I have the user_id in the session, so I want when I add a new entry to specify the user id in the code.

how can I do that ?

Renaud is Not Bill Gates
  • 1,684
  • 34
  • 105
  • 191

1 Answers1

0

Use hidden input. Like this:

$crud->field_type('user_id', 'hidden', $_SESSION['user_id']);

Or use invisible for more security. You can look the sample here: http://www.grocerycrud.com/documentation/options_functions/field_type

Jawaad
  • 466
  • 5
  • 10