[英]html <input> unable to pass value to URL unless using codeigniter's input_form
i create form search using codeigniter's form_helper 我使用codeigniter的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^^ 谢谢^^
If you want the value, please add name
attribute. 如果您想要该值,请添加name
属性。
<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..."') ?>
^ ^
Here means that create and input text with value
name with $this->input->get('value')
this value: 这意味着用$this->input->get('value')
创建和输入带有value
名称的文本这个值:
form_input( 'value', $this->input->get('value')...)
But in your case value
become attribute, not the name of name attribute
: 但在您的情况下, value
变为属性,而不是name attribute
的name attribute
:
<input type="text" class="form-control" id="value" placeholder="Search..." value="<?php echo $this->input->get('value');?>">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.