Set_value () by default in CodeIgniter

I used formigniter to create a form for CI. http://formigniter.org/

This bit works great. However, I want to set a default value for the name field.

The input code is as follows:

<label for="forename">Forename</label>
<?php echo form_error('forename'); ?>
<br /><input id="forename" type="text" name="forename" maxlength="255" value="<?php echo set_value('forename'); ?>"  />

and I would like to add a name with $this->session->userdata('current_client');

Will it break my database insert if I just go into the set_value function?

Edit:

Sorry, I don’t think it was very clear there. I want the name field to be automatically populated with the name from the session cookie.

+3
source share
3 answers

, . set_value , , .

session var :

<input id="forename" type="text" name="forename" maxlength="255" value="<?php echo set_value('forename', $this->session->userdata('current_client')); ?>"  />
+8

$data = array(
    'name' => 'qty_' . $i, 
    'size'=>15, 
    'id' => 'qty_' . $i,
    'required'=>'required', 
    'class'=>'input-small',
    'value' => set_value('qty_' . $i),
    $restock_thirty
);

echo form_input($data);
0

CodeIgniter, , , , , , set_value

<input type="text" name="username" placeholder="Username.." value="<?php echo set_value('username') ?>" class="form-control tx">
0

Source: https://habr.com/ru/post/1768251/


All Articles