How do I achieve this:
//view.php
<input type="hidden" name="Name" value="<?php echo $variable->id; ?>"
using CodeIgniter’s form_hidden helper:
//view.php
<?php echo form_hidden('Name','<?php echo $variable->id; ?>') ?>
The first one works fine when I display $variable->id but CI's form_hidden doesn't work.
The form helpers are evaluated when the script is run, just like any other script, so you do this:
<?php echo form_hidden('Name', $variable->id); ?>
If you have shorttags enabled, you could do:
<?=form_hidden('Name', $variable->id);?>
Here are the complete details for the form helper class of CodeIgniter:
https://www.codeigniter.com/user_guide/helpers/form_helper.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With