Reputation: 392
i create form search using codeigniter's form_helper
<?php echo form_open(site_url( 'lab/hasil_rawat_jalan'), array( 'method'=>'get')) ?>
<div class="form-group">
<label class="sr-only" for="value">Search</label>
<?php echo form_input( 'value', $this->input->get('value'), 'type="text" class="form-control" id="value" placeholder="Search..."') ?>
</div>
<input class="btn btn-default btn-sm" type="submit" value="Go">
</form>
the problem is if i change
<?php echo form_input( 'value', $this->input->get('value'), 'type="text" class="form-control" id="value" placeholder="Search..."') ?>
into this(which mean normal input tag)
<input type="text" class="form-control" id="value" placeholder="Search..." value="<?php echo $this->input->get('value');?>">
I can not get any value in my url, do I miss something here?
if you do not understand my question please ask. thanks^^
Upvotes: 1
Views: 721
Reputation: 9060
Here means that create and input text with value
name with $this->input->get('value')
this value:
form_input( 'value', $this->input->get('value')...)
But in your case value
become attribute, not the name of name attribute
:
<input type="text" class="form-control" id="value" placeholder="Search..." value="<?php echo $this->input->get('value');?>">
Upvotes: 0
Reputation: 11987
If you want the value, please add name
attribute.
<input name="value" type="text" class="form-control" id="value" placeholder="Search..." value="<?php echo $this->input->get('value');?>" >
^ ^
In code igniter, first parameter in the name of the text box.
<?php echo form_input( 'value', $this->input->get('value'), 'type="text" class="form-control" id="value" placeholder="Search..."') ?>
^ ^
Upvotes: 3