Codeigniter set_value not working - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Codeigniter set_value not working (/showthread.php?tid=68885) |
Codeigniter set_value not working - sebastianbo - 09-09-2017 I'm querying the DB and sending sending a $data array from my controller to my view, where I'm using CI's form helper with set_value(field_name, default) but the data is not being loaded. This is what I'm currently doing in my view: Code: <input type="hidden" id="artist-id" name="record_artist_id" value="<?php echo set_value('record_artist_id', $record_artist_id); ?>"> I thought I had to use the input helper so I tried: Code: <label for="record-name"><span class="required">*</span>Name:</label> But still not working. This is working though: Code: <input id="record-name" name="record_name" type="text" value="<?php echo (isset($record_name)) ? $record_name : ''; ?>" class="form-control"> The form helper is being loaded in autoload.php Code: $autoload['helper'] = array('url', 'file', 'form', 'base'); I don't know if this is related but I'm getting the view as a string and then passing it to a template, something like: Code: public function add_content($view, $content = NULL){ and later on in a different method: Code: // render content Any idea about what I am doing wrong? RE: Codeigniter set_value not working - Wouter60 - 09-10-2017 PHP Code: <?php RE: Codeigniter set_value not working - pippuccio76 - 03-15-2019 i have the same problem the hidden fields arent set. How can i solve it ? |