Codeigniter form_open specify id

39,118

Solution 1

https://codeigniter.com/user_guide/helpers/form_helper.html

$attributes = array('id' => 'myform');
echo form_open('email/send', $attributes);

Solution 2

You can also use:

echo form_open('controller/method',array('id'=>$id,'method'=>'post'))

Solution 3

echo form_open('controller/method',array('id'=>$id,'method'=>'post'))
Share:
39,118

Related videos on Youtube

Roman
Author by

Roman

Updated on July 09, 2022

Comments

  • Roman
    Roman almost 2 years

    How can I write the form ID in the form_open function in CodeIgniter? (I need to use the ID for the CSS). For example, this is simple HTML:

    <form method="post" action="" id="my_form">
    

    I am trying the following code, but it does not work:

    <?php echo form_open('my_form'); ?>
    

    Thanks.

  • Magisch
    Magisch over 7 years
    Please consider adding explanations to your code. While it may be self-explanatory to you, other people could very much benefit from some added explaination as to why and how your code solves the question problem.

Related