CodeIgniter Forums
2 form error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter Archived (from EllisLab) (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: 2 form error (/thread-12185.html)



2 form error - El Forum - 10-09-2008

[eluser]Yash[/eluser]
When I try to load 2 form on page ..one's < form > get truncated.

2 form on same view coming from 2 different views.

Code:
<?php              
    $attributes = array('class' => 'search', 'id' => 'search');
    
    echo form_open('blog/do_search', $attributes);
    
    ?>
  <p>  &lt;form&gt; &lt;input type="text" name="blog_search" id="blog_search" /&gt;
  </p>
  <p>
    <select name="search_area" id="search_area">
      <option value="post" selected="selected">In Posts</option>
      <option value="page">In Pages</option>
      <option value="pag">In Tags</option>
    </select>
    &lt;input type="submit" name="search" id="search" value="Search" /&gt;
  </p>
&lt;/form&gt;

View Selection Source [mozilla]
Code:
<p>  </p> &lt;input name="blog_search" id="blog_search" type="text"&gt;
  
  <p>
    <select name="search_area" id="search_area">
      <option value="post" selected="selected">In Posts</option>
      <option value="page">In Pages</option>

      <option value="pag">In Tags</option>
    </select>
    &lt;input name="search" id="search" value="Search" type="submit"&gt;
  </p>



2 form error - El Forum - 10-10-2008

[eluser]LuckyFella73[/eluser]
As far as I know you can't nest a form into a form.
More information about allowed elements in forms:
http://www.w3.org/MarkUp/html3/forms.html

In your script you open the first form via form-helper,
then you open a second form within the first via plain HTML
and in the end you have one closing form-tag.


2 form error - El Forum - 10-10-2008

[eluser]iainco[/eluser]
Why do you need 2 forms?

Code:
&lt;form action="blog/do_search" method="post" name="search" id="search"&gt;
  <p>
    &lt;input name="blog_search" id="blog_search" type="text"&gt;
  </p>
  <p>
    <select name="search_area" id="search_area">
      <option value="post" selected="selected">In Posts</option>
      <option value="page">In Pages</option>
      <option value="pag">In Tags</option>
    </select>
    &lt;input name="search_submit" id="search_submit" value="Search" type="submit"&gt;
  </p>
&lt;/form&gt;

Is the above code what you're trying to achieve?

Edit: You shouldn't give the submit field the same name and id as the form either.