Welcome Guest, Not a member yet? Register   Sign In
Problem with Form and form tags built with CodeIgniter.. URGENT assistance required

Hi All,

I am having trouble to work with forms created using codeigniter. I have tried number of ways to render a form on the webpage. But am unsuccessful at different points.

1. I tried to render a form with code:
$this -> load -> helper('form');
$formattr = array('id="form1"');
form_open('registerUsr', $formattr);

  Registration Form
<p class="first">
  <label for="firstName">First Name: </label>
  &lt;input type="text" id="name" name="firstName" size="20" value="&lt;?php echo set_value('first_name'); ?&gt;" /&gt;
<p class="first">
  <label for="scndName">Second Name: </label>
  &lt;input type="text" id="name" name="scndName" size="20" value="&lt;?php echo set_value('scnd_name'); ?&gt;" /&gt;

<p class="submit">
<button type="submit" value="Submit" />
&lt;?php echo form_close(); ?&gt;

2. I have also tried to completely render it using options given in form helper class like
&lt;?php echo form_open('registerUsr');
echo form_input('$data');
echo form_submit('submit', 'Submit');
echo form_close();?&gt;

3. I have tried hybrid variety using mix of html tags and helper class functions.

But in all the ways, on final render of the form on web page &lt;form class="form1"&gt; and &lt;/form&gt; tags are missing

And also instead of index.php/registerUsr, it is going into index.php/searchUniv page. (Checked routes.php. It is correctly pointed)

Any suggestions / ideas appreciated

TIA :-)

The attributes array must be key/value pairs like the user guide shows for form_open() in the "Adding Attributes" section. Also, you are missing an echo for form_open(). You have it for form_close().

You should also load the form helper in the controller, not the view.

Your form should submit to a controller/method, not just a controller like it currently is.

Theme © iAndrew 2016 - Forum software by © MyBB