I'd like to change the type of input field from text to numbers only.I've tried as following
<?= form_input('num', '','class="form-control" id="num", type="number"');?>
but not working
You should pass everything as an associative array, here the array index are attribute of HTML input tag.
<?= form_input(array(
'name' => 'num',
'class' => 'form-control',
'type' => 'number'// input type number
));
?>
more info: http://www.codeigniter.com/userguide2/helpers/form_helper.html