I have a page where I display BIDS (gc table) for a particular Property. It received a property_id as a hash (phase) via the URI to display related bids for the property. Here is the controller code for the gc table:
try{
$phash = $this->uri->segment(3);
$query = $this->db->query('SELECT * FROM properties WHERE phash = "'.$phash.'"');
$row = $query->row();
$address_line = $row->property_address.', '.$row->city.', '.$row->state.' '.$row->zip_code;
$crud = new grocery_CRUD();
$crud->set_primary_key('prop_bids_id','property_bids');
$crud->where('property_bids.phash', $phash);
$crud->order_by('maximum_bid','desc');
$crud->set_table('property_bids');
$crud->set_subject('Bid');
$crud->unset_read();
$crud->required_fields('user_id','maximum_bid');
$crud->set_relation('user_id','users','{first_name} {last_name}');
$crud->set_relation('property_item_id','properties','{property_address}, {city}, {state} {zip_code}');
$crud->display_as('user_id','Investor');
$crud->display_as('property_item_id','Property');
$crud->display_as('maximum_bid','Maximum Bid');
$crud->display_as('bid_instructions','Bid Instructions');
$crud->display_as('back_up_amount','Backup Amount');
$crud->columns('user_id','maximum_bid','bid_instructions', 'back_up_amount');
$crud->fields('property_item_id','user_id','maximum_bid','bid_instructions', 'back_up_amount');
$crud->field_type('property_item_id', 'readonly');
$crud->field_type('phash', 'invisible', $phash);
$crud->unset_texteditor('bid_instructions');
$output = $crud->render();
$output->pAddress = $address_line; // passes address to page
$this->manage_bids_output($output);
}catch(Exception $e){
show_error($e->getMessage().' --- '.$e->getTraceAsString());
}
On the EDIT form, the first line is the "property_item_id" which them displays the Property address as {property_address}, {city}, {state} {zip_code}. This is perfect and keep the user orientated to what property this existing is related to.
BUT...
On the NEW BID FORM, the first line is labeled Property but the value is blank. I know this is because the EDIT was reading data from the row and the NEW has not be created yet.
QUESTION: How can I get the variable "$address_line" as the value of the first line.
Also, I need to include the "property_item_id" and "phash" fields in the ADD form as hidden fields do they insert into my new row.
I can't seem to find the proper combinations to get it all to work.
Any insights would be appreciated. Love the GC framework so far and each hurdle I conquer make me more efficient and wiser in using it. Thanks in advance!