CodeIgniter Forums

Full Version: Example for form_open() in php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Joviac[/eluser]
Hi everyone,
I am newer to php.I need to use form_open() in my php program,so please reply your answer for my request..

El Forum

[eluser]psp83[/eluser]
Hi Joviac.

Here's how you use the form_open().

Code:
<?php

// load the form helper so you can use set_value, form_open etc
$this->load->helper('form');

echo form_open('location/to/sumbit/to');

echo "Username : ". form_input('username', set_value('username'));
echo "Password : ". form_password('password', set_value('password'));
echo form_submit('submit', 'Login');

echo form_close();

?>

The above form is just a basic form, you can read more about the form helper here : http://ellislab.com/codeigniter/user-gui...elper.html

Hope the above helps you.

El Forum

[eluser]Joviac[/eluser]
Hi paulparadise
Thank u very much...its working

El Forum

El Forum

[eluser]shahnawazahmed[/eluser]
hello psp , why we use this code to create forms in php ? we can also do this in Html forms .
<?php
echo form_open('location/to/sumbit/to');
echo "Username : ". form_input('username', set_value('username'));
echo "Password : ". form_password('password', set_value('password'));
echo form_submit('submit', 'Login');

echo form_close();

?>