0

Hello team I have a small issue and I would like to know the cause please see code below:

<input type="text" class="span6" id="item_title" value ="<?php echo set_value('$item_title'); ?>">

The preceding code gives me an validation error in Codeigniter however this code

<?php echo form_input('item_title', $item_title); ?>

It works fine with no validation error.The error indicates that the Item title field is required however i do not get this error with the latter script any ideas.

denny
  • 2,084
  • 2
  • 15
  • 19
bsquad
  • 66
  • 8

2 Answers2

1

The first parameter of set_value () takes field name and second take value you are providing only the field name since it is in single quotation do it something like this set_value ('item_title', $item_title)

Abdul Bari
  • 149
  • 1
  • 2
  • 12
1
<input type="text" class="form-control" id="firstname" name="firstname" placeholder="First Name"  value="<?php echo set_value('firstname'); ?>" >

here for set value use like above example,where firstname in set_value('firstname') is name of input element

Jalpesh
  • 63
  • 6