How to mix PHP with a string inside CodeIgniter function? -
i dynamically set id
each iteration of radio button within loop.
however have not been able figure out correct way of escaping strings , variables in id
portion. quotes in portion failing parse.
<?php echo form_radio($data['filename'], 0, '', 'class="uniform" id="'$data['ids']'"); ?>
this uses form
helpers codeigniter have layout.
any idea how solve this?
you must start double quotes expanded variables, escape nested ones backslash
<?php echo form_radio($data['filename'], 0, '', "class=\"uniform\" id=\"$data[ids]\"");
or use single quotes inside double
<?php echo form_radio($data['filename'], 0, '', "class='uniform' id='$data[ids]'");
notice don't need quote single dimensional array indexes inside square braces if inside double quotes
Comments
Post a Comment