<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>gotphp.com</title>
	
	<link>http://www.gotphp.com</link>
	<description>Practical Coding Examples and Advice For PHP Developers</description>
	<lastBuildDate>Tue, 06 Sep 2011 01:01:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/gotphp" /><feedburner:info uri="gotphp" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>What’s Your Biggest Frustration with Building Software Apps Using CodeIgniter?</title>
		<link>http://feedproxy.google.com/~r/gotphp/~3/w8OzOq-uatE/</link>
		<comments>http://www.gotphp.com/biggest-frustration-building-software-apps-codeigniter/54661/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 01:01:02 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>

		<guid isPermaLink="false">http://www.gotphp.com/?p=661</guid>
		<description><![CDATA[<p>I&#8217;ve been working with CodeIgniter for many years and I&#8217;ve used it to build several production level apps for my clients and for myself.</p> <p>In general, I find it a great framework. However that was not always the case, especially when just starting out.</p> <p>What I&#8217;d like to do is start putting together some practical [...]


]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with CodeIgniter for many years and I&#8217;ve used it to build several production level apps for my clients and for myself.</p>
<p>In general, I find it a great framework. However that was not always the case, especially when just starting out.</p>
<p>What I&#8217;d like to do is start putting together some practical and some real in-depth CodeIgniter tutorials for you to help shorten your learning curve&#8230;but I need your help.</p>
<p>So, please take this 3 minute survey and tell me what frustrates you the most about building web apps using CodeIgniter.</p>
<p><a  href="http://www.surveymonkey.com/s/9T3BLWZ" target="_blank">http://www.surveymonkey.com/s/9T3BLWZ</a></p>
<p>Thanks in advance!</p>
<p><em>PS. I&#8217;ll enter everyone who fills out the 3 minute survey into a drawing to win a $100 Apple Gift Card.</em></p>
<p>Michael</p>


<p></p><img src="http://feeds.feedburner.com/~r/gotphp/~4/w8OzOq-uatE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gotphp.com/biggest-frustration-building-software-apps-codeigniter/54661/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.gotphp.com/biggest-frustration-building-software-apps-codeigniter/54661/</feedburner:origLink></item>
		<item>
		<title>CodeIgniter Tutorial set_value()</title>
		<link>http://feedproxy.google.com/~r/gotphp/~3/pCfDrxj90Gk/</link>
		<comments>http://www.gotphp.com/codeigniter-tutorial-set_value/54589/#comments</comments>
		<pubDate>Sat, 07 May 2011 03:19:15 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[codeginter form]]></category>
		<category><![CDATA[Form Helper]]></category>
		<category><![CDATA[repopulate form value]]></category>
		<category><![CDATA[set_value]]></category>

		<guid isPermaLink="false">http://www.gotphp.com/?p=589</guid>
		<description><![CDATA[<p>CodeIgniter has a helper function that you can use to repopulate your form. It&#8217;s in the form helper. To use it, load the helper first.<br /> apps/main/controllers/formexample.php</p> function __construct() { parent::__construct(); $this-&#62;load-&#62;helper(&#039;form&#039;); } <p>set_value returns the value from the $_POST array for the specified field. It can be used to retrieve values for textarea&#8216;s and [...]

<br clear="all">
Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-forms-tutorial/54535/' rel='bookmark' title='CodeIgniter Forms Tutorial'>CodeIgniter Forms Tutorial</a></li>
<li><a href='http://www.gotphp.com/codeigniter-file-upload-and-email-example/54438/' rel='bookmark' title='CodeIgniter File Upload And Email Example'>CodeIgniter File Upload And Email Example</a></li>
<li><a href='http://www.gotphp.com/storing-codeigniter-session-data-to-a-database/54471/' rel='bookmark' title='Storing Codeigniter Session Data to a Database'>Storing Codeigniter Session Data to a Database</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>CodeIgniter has a helper function that you can use to repopulate your form. It&#8217;s in the form helper. To use it, load the helper first.<br />
<strong><em>apps/main/controllers/formexample.php</em></strong></p>
<pre class="brush: php">
function __construct() {
  parent::__construct();
  $this-&gt;load-&gt;helper(&#039;form&#039;);
}
</pre>
<p><strong>set_value</strong> returns the value from the $_POST array for the specified field. It can be used to retrieve values for <strong>textarea</strong>&#8216;s and <strong>text</strong> fields.<br />
<strong><em>apps/main/controllers/formexample.php</em></strong></p>
<pre class="brush: php">
function create() {
  // First parameter is the field name, second is the default value.
  $user_name = set_value(&#039;user_name&#039;, &#039;&#039;);
  $password = set_value(&#039;password&#039;);    

  // Set the view values, this part depends on how you set views.
  $this-&gt;tpl_data += array(
		    &#039;form_action&#039;	=&gt; &#039;formexample/create&#039;,
			&#039;user_name&#039; 	=&gt; $user_name,
			&#039;password&#039; 		=&gt; $password,
		);
  // Load the view
  $this-&gt;_tpl(&#039;formexample/edit&#039;);
}
</pre>
<p><strong><em>apps/main/views/formexample/edit.php</em></strong></p>
<pre class="brush: php">
echo form_open($form_action, &#039;&#039;, array (&#039;submit&#039; =&gt; true))

// Create an array which contains the html attributes
// we want for the user_name field.
$user_name_attribs = array (
                        &#039;name&#039;  =&gt; &#039;user_name&#039;,
                        &#039;id&#039;    =&gt; &#039;user_name&#039;,
                        &#039;value&#039; =&gt; $user_name
                     );
// Create the text field using the attributes from the array we created earlier.
echo form_input($user_name_attribs);

// This creates a password type input field.
echo form_password(&#039;password&#039;, $password);

echo form_submit(&#039;submit&#039;, &#039;Submit&#039;);
// Close the form.
echo form_close();
</pre>
<p>Another thing about CodeIgniter&#8217;s set_value() function is that it automatically applies htmlspecialchars() to the value being requested, so that the text can be placed safely in form fields.</p>
<p><strong>Download the files and test it out.</strong></p>
<p><script src="http://forms.aweber.com/form/32/159230832.js" type="text/javascript"></script></p>
<p><strong>If you found this article useful, please share your comments below.</strong></p>


<br clear="all"><p>Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-forms-tutorial/54535/' rel='bookmark' title='CodeIgniter Forms Tutorial'>CodeIgniter Forms Tutorial</a></li>
<li><a href='http://www.gotphp.com/codeigniter-file-upload-and-email-example/54438/' rel='bookmark' title='CodeIgniter File Upload And Email Example'>CodeIgniter File Upload And Email Example</a></li>
<li><a href='http://www.gotphp.com/storing-codeigniter-session-data-to-a-database/54471/' rel='bookmark' title='Storing Codeigniter Session Data to a Database'>Storing Codeigniter Session Data to a Database</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/gotphp/~4/pCfDrxj90Gk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gotphp.com/codeigniter-tutorial-set_value/54589/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.gotphp.com/codeigniter-tutorial-set_value/54589/</feedburner:origLink></item>
		<item>
		<title>CodeIgniter .htaccess Setup</title>
		<link>http://feedproxy.google.com/~r/gotphp/~3/lar_i6qd5WQ/</link>
		<comments>http://www.gotphp.com/codeigniter-htaccess-setup/54558/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 12:30:52 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[search engine]]></category>
		<category><![CDATA[search engine friendly url]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://www.gotphp.com/?p=558</guid>
		<description><![CDATA[<p>CodeIgniter provides the option to use Search Engine friendly URL&#8217;s in your application. Search Engine friendly URL&#8217;s let&#8217;s spiders index your site better and are visually more attractive.</p> mod_rewrite and the Index page <p>Before anything else, make sure you have mod_rewrite enabled on your server. Once that&#8217;s taken care of, edit your index.php file and [...]

<br clear="all">
Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-file-upload-and-email-example/54438/' rel='bookmark' title='CodeIgniter File Upload And Email Example'>CodeIgniter File Upload And Email Example</a></li>
<li><a href='http://www.gotphp.com/codeigniter-profiler-extended/54358/' rel='bookmark' title='CodeIgniter Profiler Extended'>CodeIgniter Profiler Extended</a></li>
<li><a href='http://www.gotphp.com/codeigniter-short-url-redirect-example/54427/' rel='bookmark' title='CodeIgniter Short URL Redirect Example'>CodeIgniter Short URL Redirect Example</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>CodeIgniter provides the option to use Search Engine friendly URL&#8217;s in your application. Search Engine friendly URL&#8217;s let&#8217;s spiders index your site better and are visually more attractive.</p>
<h2>mod_rewrite and the Index page</h2>
<p>Before anything else, make sure you have mod_rewrite enabled on your server. Once that&#8217;s taken care of, edit your index.php file and set $config['index_page'] to blank.</p>
<p><em><strong>index.php</strong></em></p>
<pre class="brush: php">

$config[&#039;index_page&#039;] = &#039;&#039;;
</pre>
<h2>Creating the .htaccess file</h2>
<p>Go to your root directory, create a file called  &#8220;.htaccess&#8221; and paste the following.</p>
<pre class="brush: php">
# Set the default file for indexes
DirectoryIndex index.php

# mod_rewrite rules
RewriteEngine on

# The RewriteBase of the system (if you are using this system in a sub-folder).
# RewriteBase /SubFolderName/

# This will make the site only accessible without the &quot;www.&quot;
# (which will keep the subdomain-sensive config file happy)
# If you want the site to be accessed WITH the &quot;www.&quot;
# comment-out the following two lines.
# RewriteCond %{HTTP_HOST} ^www\.site\.com$ [NC]
# RewriteRule ^(.*)$ http://site.com/$1 [L,R=301]

# If a controller can&#039;t be found - then issue a 404 error from PHP
# Error messages (via the &quot;error&quot; plugin)
# ErrorDocument 403 /index.php/403/
# ErrorDocument 404 /index.php/404/
# ErrorDocument 500 /index.php/500/

# Deny any people (or bots) from the following sites: (to stop spam comments)
# RewriteCond %{HTTP_REFERER} nienschanz\.ru [NC,OR]
# RewriteCond %{HTTP_REFERER} porn\.com
# RewriteRule .* - [F]
# Note: if you are having trouble from a certain URL just
# add it above to bock all visitors from that site.

# Or you can also uncomment this if you know the IP:
# Deny from 192.168.1.1

# If the file is NOT the index.php file
RewriteCond %{REQUEST_FILENAME} !index.php

# Hide all PHP files so none can be accessed by HTTP
RewriteRule (.*)\.php$ index.php/$1

# If the file/dir is NOT real go to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

# If mod_rewrite is NOT installed go to index.php

ErrorDocument 404 index.php
</pre>
<p><strong>Download the files and test it out.</strong></p>
<p><script src="http://forms.aweber.com/form/32/159230832.js" type="text/javascript"></script></p>
<p><strong>If you found this article useful, please share your comments below.</strong></p>


<br clear="all"><p>Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-file-upload-and-email-example/54438/' rel='bookmark' title='CodeIgniter File Upload And Email Example'>CodeIgniter File Upload And Email Example</a></li>
<li><a href='http://www.gotphp.com/codeigniter-profiler-extended/54358/' rel='bookmark' title='CodeIgniter Profiler Extended'>CodeIgniter Profiler Extended</a></li>
<li><a href='http://www.gotphp.com/codeigniter-short-url-redirect-example/54427/' rel='bookmark' title='CodeIgniter Short URL Redirect Example'>CodeIgniter Short URL Redirect Example</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/gotphp/~4/lar_i6qd5WQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gotphp.com/codeigniter-htaccess-setup/54558/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.gotphp.com/codeigniter-htaccess-setup/54558/</feedburner:origLink></item>
		<item>
		<title>CodeIgniter Forms Tutorial</title>
		<link>http://feedproxy.google.com/~r/gotphp/~3/uEzZtapiQKE/</link>
		<comments>http://www.gotphp.com/codeigniter-forms-tutorial/54535/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 03:19:10 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[CodeIgniter forms tutorial]]></category>
		<category><![CDATA[codeigniter tutorial]]></category>
		<category><![CDATA[Form Helper]]></category>
		<category><![CDATA[Form Validation Library]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[helpers]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://www.gotphp.com/?p=535</guid>
		<description><![CDATA[<p>CodeIgniter offers a bunch of helpers to speed up development.&#160; There are URL Helpers, that assist in creating links, there are Form Helpers that help you create form elements, Text Helpers perform various text formatting routines, Cookie Helpers set and read cookies, File Helpers help you deal with files, etc.</p> <p>As the title implies this [...]

<br clear="all">
Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-file-upload-and-email-example/54438/' rel='bookmark' title='CodeIgniter File Upload And Email Example'>CodeIgniter File Upload And Email Example</a></li>
<li><a href='http://www.gotphp.com/storing-codeigniter-session-data-to-a-database/54471/' rel='bookmark' title='Storing Codeigniter Session Data to a Database'>Storing Codeigniter Session Data to a Database</a></li>
<li><a href='http://www.gotphp.com/how-to-upgrade-to-codeigniter-2/54530/' rel='bookmark' title='How To Upgrade to CodeIgniter 2.0'>How To Upgrade to CodeIgniter 2.0</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>CodeIgniter offers a bunch of helpers to speed up development.&nbsp; There are <dfn>URL Helpers</dfn>, that assist in creating links, there are <dfn>Form Helpers</dfn> that help you create form elements, <dfn>Text Helpers</dfn> perform various text formatting routines, <dfn>Cookie Helpers</dfn> set and read cookies, <dfn>File Helpers</dfn> help you deal with files, etc.</p>
<p>As the title implies this tutorial will guide you through the basic usage of one of the most commonly used and valuable helper, the Fo﻿rm Helpers. Part of this forms tutorial is the use of the Form Validation library which has different options for form validation.</p>
<p>&nbsp;</p>
<h2>Setting up the form</h2>
<hr />
<p>By default CodeIgniter does not load any helpers, so the first step should be to load the Form Helper either in your autoload.php file or in the controller you want to use.</p>
<p><em><strong>apps/main/config/autoload.php</strong></em></p>
<pre class="brush:php">$autoload['helper'] = array('form');</pre>
<p><em><strong>apps/main/controllers/formexample.php</strong></em></p>
<pre class="brush: php">
$this-&amp;gt;load-&amp;gt;helper(&#039;form&#039;);
</pre>
<p>When loading via the controller always remember to load the form helper first before using any form helper function.</p>
<p>In this forms tutorial will be using most of the Form Helper functions inside our view.</p>
<p><em><strong>apps/main/controllers/formexample/php</strong></em></p>
<pre class="brush: php">
function create()
{
$this-&amp;gt;load-&amp;gt;view(&#039;formexample/edit&#039;);
}
</pre>
<p>CodeIgniter forms helper provides various functions to generate different form elements such as form_open(), form_close(), form_label(), form_input(), form_password(), form_radio() and form_checkbox(). These let you create form elements on the fly without going through so much html.</p>
<p>Inside our view let&#8217;s create the opening form tag using form_open().</p>
<p><em><strong>apps/main/views/formexample/edit.php</strong></em></p>
<pre class="brush: php">
echo form_open($form_action, &#039;&#039;, array (&#039;submit&#039; =&amp;gt; true));
</pre>
<p>The first argument is our form&#8217;s action, the second would be an array of additional attributes we want to add to the form, and the third is an array of hidden fields we want to create alongside the form.</p>
<h3>Adding fields.</h3>
<p>Most form helper functions can be used in two ways.</p>
<p>The first method is to pass a field name to the first parameter and a default value (optional) to the second.</p>
<pre class="brush:php">echo form_input('user_name', 'john doe');</pre>
<p>And the second method is to pass an associative array, which contains the html attributes, to the function.</p>
<pre class="brush: php">
$user_name_attribs = array (
&#039;name&#039;  =&amp;gt; &#039;user_name&#039;,
&#039;id&#039;    =&amp;gt; &#039;user_name&#039;,
&#039;value&#039; =&amp;gt; &#039;john doe&#039;
);
echo form_input($user_name_attribs);
</pre>
<p>We&#8217;ll use the second method in this forms tutorial. So let&#8217;s add it to our edit.php file and some other fields as well.</p>
<p><em><strong>apps/main/views/formexample/edit.php</strong></em></p>
<pre class="brush: php">
echo form_open($form_action, &#039;&#039;, array (&#039;submit&#039; =&amp;gt; true));
$user_name_attribs = array (
&#039;name&#039;  =&amp;gt; &#039;user_name&#039;,
&#039;id&#039;    =&amp;gt; &#039;user_name&#039;,
&#039;value&#039; =&amp;gt; &#039;john doe&#039;
);
echo form_input($user_name_attribs);
// This creates a password type input field.
echo form_password(&#039;password&#039;);
// Create the email field.
echo form_input(&#039;email&#039;);
// Create radio buttons for gender, as with standard html the first parameter
// determines the grouping.
echo form_radio(&#039;gender&#039;, &#039;1&#039;, TRUE) . &#039; Male&#039;;
echo form_radio(&#039;gender&#039;, &#039;0&#039;) . &#039; Female&#039;;
</pre>
<p>The form_input() method creates an input field of type <strong>text</strong> and renders it as html.</p>
<p>Now let&#8217;s add a label to the input field we just created using the form_label() method. Just like the form_input() method we can either pass an associative array to the form_label() function, but we&#8217;ll keep it simple and pass two parameters, the text we want to display and the name of the field it is for.</p>
<pre class="brush: php">
echo form_label(&#039;Username:&#039;, &#039;user_name&#039;);
</pre>
<h3>Dropdown boxes</h3>
<p>When creating a dropdown box we must first define an array which contains the options and their respective values.</p>
<pre class="brush: php">
// This array contains the options for our dropdown.
$dropdown_options = array (
&#039;1&#039; =&amp;gt; &#039;Option 1&#039;,
&#039;2&#039; =&amp;gt; &#039;Option 2&#039;,
&#039;3&#039; =&amp;gt; &#039;Option 3&#039;
);

// Create the dropdown using the options above.
echo form_dropdown(&#039;options&#039;, $dropdown_options);
</pre>
<h3>Submit button and closing form tag</h3>
<p>The submit button is created much like the form_input() method.</p>
<pre class="brush: php">
echo form_submit(&#039;submit&#039;, &#039;Submit&#039;);
</pre>
<p>Closing the form is as simple as calling the form_close() function.</p>
<p>Now let&#8217;s take a look at what we currently have going for edit.php</p>
<p><em><strong>apps/main/views/formexample/edit.php</strong></em></p>
<pre class="brush: php">
echo form_open($form_action, &#039;&#039;, array (&#039;submit&#039; =&amp;gt; true));

// Create an array which contains the html attributes
// we want for the user_name field.
$user_name_attribs = array (
&#039;name&#039;&amp;nbsp; =&amp;gt; &#039;user_name&#039;,
&#039;id&#039;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;gt; &#039;user_name&#039;,
&#039;value&#039; =&amp;gt; &#039;john_doe&#039;
);

// Create our label for user_name.
echo form_label(&#039;Username:&#039;, &#039;user_name&#039;);

// Create the text field using the attributes from the array we created earlier.
echo form_input($user_name_attribs);
// form_error displays the error message after validation.
echo &quot;&amp;lt;br/&amp;gt;&quot;;

// Create the label for the password field.
echo form_label(&#039;Password:&#039;, &#039;password&#039;);

// This creates a password type input field.
echo form_password(&#039;password&#039;);

echo &quot;&amp;lt;br/&amp;gt;&quot;;

// Create the label for the email field.
echo form_label(&#039;Email:&#039;, &#039;email&#039;);

// Create the email field.
echo form_input(&#039;email&#039;);

echo &quot;&amp;lt;br/&amp;gt;&quot;;

// Create the label for gender.
echo form_label(&#039;Gender:&#039;, &#039;gender&#039;);

// Create radio buttons for gender, as with standard html the first parameter
// determines the grouping.
echo form_radio(&#039;gender&#039;, &#039;1&#039;, TRUE) . &#039; Male&#039;;
echo form_radio(&#039;gender&#039;, &#039;0&#039;) . &#039; Female&#039;;

echo &quot;&amp;lt;br/&amp;gt;&quot;;

// This array contains the options for our dropdown.
$dropdown_options = array (
&#039;1&#039; =&amp;gt; &#039;Option 1&#039;,
&#039;2&#039; =&amp;gt; &#039;Option 2&#039;,
&#039;3&#039; =&amp;gt; &#039;Option 3&#039;
);

echo form_label(&#039;Choose 1:&#039;, &#039;options&#039;);

// Create the dropdown using the options above.
echo form_dropdown(&#039;options&#039;, $dropdown_options);

echo &quot;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&quot;;

echo form_submit(&#039;submit&#039;, &#039;Submit&#039;);

// Close the form.
echo form_close();
</pre>
<p>Now that we have our form ready, let&#8217;s setup form validation and processing.</p>
<h2>Form validation and processing</h2>
<hr />
<p>As with any library, we have to load the form_validation helper in order to use it. So on your controller place the following code.</p>
<pre class="brush: php">
$this-&amp;gt;load-&amp;gt;library(&#039;form_validation&#039;);
</pre>
<h3>Defining the rules.</h3>
<p>The form_validation library provides us with the following set of rules that we can use.</p>
<ul>
<li>required</li>
<li>matches</li>
<li>min_length</li>
<li>max_length</li>
<li>exact_length</li>
<li>alpha</li>
<li>alpha_numeric</li>
<li>alpha_dash</li>
<li>numeric</li>
<li>integer</li>
<li>is_natural</li>
<li>is_natural_no_zero</li>
<li>valid_email</li>
<li>valid_emails</li>
<li>valid_ip</li>
<li>valid_base64</li>
</ul>
<p>To use these methods we have to call the Form Validation library&#8217;s set_rules() function like so.</p>
<p><strong><em>apps/main/controllers/formexample.php</em></strong></p>
<pre class="brush: php">
function create()
{
$this-&amp;gt;load-&amp;gt;library(&#039;form_validation&#039;);

// Here we tell CodeIgniter about our validation rules.
$this-&amp;gt;form_validation-&amp;gt;set_rules(&#039;user_name&#039;, &#039;Username&#039;, &#039;required&#039;);
$this-&amp;gt;form_validation-&amp;gt;set_rules(&#039;password&#039;, &#039;Password&#039;, &#039;required&#039;);
// We can also use cascading rules like so.
$this-&amp;gt;form_validation-&amp;gt;set_rules(&#039;email&#039;, &#039;Email&#039;, &#039;required|valid_email&#039;);
}
</pre>
<p>Once we receive a POST request we can call the run() method to start the validation process. This method returns either TRUE or FALSE.</p>
<pre class="brush: php">
if ($this-&amp;gt;form_validation-&amp;gt;run())
{
// Process the form.
}
</pre>
<h3>Error messages.</h3>
<p>We can show validation error messages individually by using the form_error() function. Just pass the field name as a parameter.</p>
<p><strong><em>apps/main/views/formexample/edit.php</em></strong></p>
<pre class="brush: php">
echo form_input($user_name_attribs);
// form_error displays the error message after validation.
echo form_error(&#039;user_name&#039;);
</pre>
<p><strong>Download the files and test it out.</strong></p>
<p><script src="http://forms.aweber.com/form/32/159230832.js" type="text/javascript"></script></p>
<p><strong>If you found this article useful, please share your comments below.</strong></p>


<br clear="all"><p>Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-file-upload-and-email-example/54438/' rel='bookmark' title='CodeIgniter File Upload And Email Example'>CodeIgniter File Upload And Email Example</a></li>
<li><a href='http://www.gotphp.com/storing-codeigniter-session-data-to-a-database/54471/' rel='bookmark' title='Storing Codeigniter Session Data to a Database'>Storing Codeigniter Session Data to a Database</a></li>
<li><a href='http://www.gotphp.com/how-to-upgrade-to-codeigniter-2/54530/' rel='bookmark' title='How To Upgrade to CodeIgniter 2.0'>How To Upgrade to CodeIgniter 2.0</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/gotphp/~4/uEzZtapiQKE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gotphp.com/codeigniter-forms-tutorial/54535/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.gotphp.com/codeigniter-forms-tutorial/54535/</feedburner:origLink></item>
		<item>
		<title>How To Upgrade to CodeIgniter 2.0</title>
		<link>http://feedproxy.google.com/~r/gotphp/~3/8Q1fNGAiB9k/</link>
		<comments>http://www.gotphp.com/how-to-upgrade-to-codeigniter-2/54530/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 00:46:02 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[CI 2.0]]></category>
		<category><![CDATA[Upgrade]]></category>

		<guid isPermaLink="false">http://www.gotphp.com/?p=530</guid>
		<description><![CDATA[<p>Last January 28, 2011 EllisLab officially released CodeIgniter 2.0.0. For those of you who are still using older versions of CodeIgniter here&#8217;s how to upgrade to CodeIgniter 2.0 :</p> <p>Download CodeIgniter 2.0 <a title="download CodeIgniter 2.0" href="http://codeigniter.com/download.php" target="_blank">here</a>.</p> Step 1: Update CodeIgniter&#8217;s core libraries. <p>Replace the contents of your &#8220;system&#8221; folder except your &#8220;application&#8221; folder.</p> [...]

<br clear="all">
Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-file-upload-and-email-example/54438/' rel='bookmark' title='CodeIgniter File Upload And Email Example'>CodeIgniter File Upload And Email Example</a></li>
<li><a href='http://www.gotphp.com/storing-codeigniter-session-data-to-a-database/54471/' rel='bookmark' title='Storing Codeigniter Session Data to a Database'>Storing Codeigniter Session Data to a Database</a></li>
<li><a href='http://www.gotphp.com/codeigniter-profiler-extended/54358/' rel='bookmark' title='CodeIgniter Profiler Extended'>CodeIgniter Profiler Extended</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Last January 28, 2011 EllisLab officially released CodeIgniter 2.0.0. For those of you who are still using older versions of CodeIgniter here&#8217;s how to upgrade to CodeIgniter 2.0 :</p>
<p><em>Download CodeIgniter 2.0 <a  title="download CodeIgniter 2.0" href="http://codeigniter.com/download.php" target="_blank">here</a>.</em></p>
<hr />
<h2>Step 1: Update CodeIgniter&#8217;s core libraries.</h2>
<p>Replace the contents of your &#8220;system&#8221; folder <strong>except</strong> your &#8220;<strong>application</strong>&#8221; folder.</p>
<p>Be sure to have a backup just in case you have edited some of these files.</p>
<hr />
<h2>Step 2: Convert your plugins to helpers.</h2>
<p>For CodeIgniter 2.0 plugins have been completely replaced by helpers, so move all your plugins to your <strong>helpers </strong>folder, rename the files accordingly so such as <var>filename_pi.php</var> to <var>filename_helper.php</var> and change all instances of:</p>
<pre class="brush: php">
$this-&amp;gt;load-&amp;gt;plugin(&#039;foo&#039;);
</pre>
<p>to</p>
<pre class="brush: php">
$this-&amp;gt;load-&amp;gt;helper(&#039;foo&#039;);
</pre>
<hr />
<h2>Step 3: Update stored encrypted data.</h2>
<p>The Encryption library has had a number of improvements, some for encryption strength and some for performance, that has an unavoidable consequence of making it no longer possible to decode encrypted data produced by the original version of this library. To help with the transition, a new method has been added, encode_from_legacy() that will decode the data with the original algorithm and return a re-encoded string using the improved methods. This will enable you to easily replace stale encrypted data with fresh in your applications, either on the fly or en masse.</p>
<hr />
<h2>Step 4: Remove loading calls for the compatibility helper.</h2>
<p>The compatibility helper has been removed from the CodeIgniter core. All methods in it should be natively available in supported PHP versions.</p>
<hr />
<h2>Step 5: Update class extensions.</h2>
<p>All core classes are now prefixed with CI_. Update Models and Controllers to extend CI_Model and CI_Controller, respectively.</p>
<hr />
<h2>Step 6: Update Parent Constructor calls</h2>
<p>All native CodeIgniter classes now use the PHP 5 __construct() convention. Please update extended libraries to call parent::__construct().</p>
<p><strong>Note:</strong> Support for PHP 4 is gone, PHP 5.1 is now a requirement.</p>
<hr />
<h2>Step 7: Add CodeIgniter 2.0&#8242;s new directories.</h2>
<p>If you check CodeIgniter 2.0&#8242;s file structure you should see new folders: <strong>core</strong>, <strong>third_party</strong>, <strong> </strong>and <strong>logs</strong>. So go ahead and create these folders on you <strong>application</strong> folder.</p>
<hr />
<h2>Step 8: Move extended core classes.</h2>
<p>Now that you have created the <strong>core</strong> folder, move all extensions you have made in your libraries folder to the core folder in the applications directory.</p>
<p><strong>Example:</strong><br />
From</p>
<p><var>/application/libraries/MY_Controller.php</var><br />
<var>/application/libraries/MY_Model.php</var></p>
<p>To</p>
<p><var>/application/core/MY_Controller.php</var><br />
<var>/application/core/MY_Model.php</var></p>
<hr />
<h2>Step 9: Update index.php.</h2>
<p>Open up your index.php and look for the line that says:</p>
<pre class="brush: php">
require_once BASEPATH.&#039;codeigniter/CodeIgniter&#039;.EXT;
</pre>
<p>replace that with</p>
<pre class="brush: php">
require_once BASEPATH.&#039;core/CodeIgniter&#039;.EXT;
</pre>
<p>If you would notice CodeIgniter 2.0&#8242;s file structure in the system folder has changed a bit.</p>
<p>&#8230;.and you&#8217;re done!</p>
<p>&nbsp;</p>
<p>Have a look at CodeIgniter 2.0&#8242;s <a  href="http://codeigniter.com/user_guide/changelog.html">change log</a> for the full list of improvements and enhancements.</p>
<p><strong>Download the files and test it out.</strong></p>
<p><script src="http://forms.aweber.com/form/32/159230832.js" type="text/javascript"></script></p>
<p><strong>If you found this article useful, please share your comments below.</strong></p>


<br clear="all"><p>Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-file-upload-and-email-example/54438/' rel='bookmark' title='CodeIgniter File Upload And Email Example'>CodeIgniter File Upload And Email Example</a></li>
<li><a href='http://www.gotphp.com/storing-codeigniter-session-data-to-a-database/54471/' rel='bookmark' title='Storing Codeigniter Session Data to a Database'>Storing Codeigniter Session Data to a Database</a></li>
<li><a href='http://www.gotphp.com/codeigniter-profiler-extended/54358/' rel='bookmark' title='CodeIgniter Profiler Extended'>CodeIgniter Profiler Extended</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/gotphp/~4/8Q1fNGAiB9k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gotphp.com/how-to-upgrade-to-codeigniter-2/54530/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.gotphp.com/how-to-upgrade-to-codeigniter-2/54530/</feedburner:origLink></item>
		<item>
		<title>Top CodeIgniter Tutorials for New CodeIgniter Developers</title>
		<link>http://feedproxy.google.com/~r/gotphp/~3/hLIdXImZaA4/</link>
		<comments>http://www.gotphp.com/top-codeigniter-tutorials-for-new-codeigniter-developers/54511/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 04:00:17 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[CodeIgniter Developers]]></category>
		<category><![CDATA[codeigniter tutorial]]></category>

		<guid isPermaLink="false">http://www.gotphp.com/?p=511</guid>
		<description><![CDATA[<p>One of my clients runs a very large offshore application development business. I manage two teams of developers building some really cool internal apps that &#8220;processify&#8221; manual tasks; and we use CodeIgniter to help expedite the development process. Occasionally a new developer will join our team with little to no experience with the CodeIgniter framework. [...]

<br clear="all">
Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-short-url-redirect-example/54427/' rel='bookmark' title='CodeIgniter Short URL Redirect Example'>CodeIgniter Short URL Redirect Example</a></li>
<li><a href='http://www.gotphp.com/codeigniter-with-zend-framework-libraries/54312/' rel='bookmark' title='CodeIgniter with Zend Framework Libraries'>CodeIgniter with Zend Framework Libraries</a></li>
<li><a href='http://www.gotphp.com/storing-codeigniter-session-data-to-a-database/54471/' rel='bookmark' title='Storing Codeigniter Session Data to a Database'>Storing Codeigniter Session Data to a Database</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>One of my clients runs a very large offshore application development business. I manage two teams of developers building some really cool internal apps that &#8220;processify&#8221; manual tasks; and we use CodeIgniter to help expedite the development process. Occasionally a new developer will join our team with little to no experience with the CodeIgniter framework. Here&#8217;s a collection of the top CodeIgniter Tutorials that I have them go through to bring them up to speed fast.</p>
<h2>CodeIgniter &#8211; Getting Started</h2>
<ul>
<li><a  href="http://net.tutsplus.com/tutorials/php/codeigniter-basics/" target="_blank">Everything You Need to Get Started With CodeIgniter</a></li>
<li><a  href="http://net.tutsplus.com/articles/news/easy-development-with-codeigniter" target="_blank">Easy Development With CodeIgniter</a></li>
</ul>
<h2>Become a CodeIgniter Pro in 15 Days!</h2>
<ul>
<li><a  href="http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-1/" target="_blank">Day 1: Getting Started With the Framework</a></li>
<li><a  href="http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-2" target="_blank">Day 2: Database Selecting Methods</a></li>
<li><a  href="http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-3/" target="_blank">Day 3: Sending Emails</a></li>
<li><a  href="http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-4-newsletter-signup/" target="_blank">Day 4: Newsletter Signup</a></li>
<li><a  href="http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-5-crud/" target="_blank">Day 5: CRUD</a></li>
<li><a  href="http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-6-login" target="_blank">Day 6: Login</a></li>
<li><a  href="http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-7-pagination/" target="_blank">Day 7: Pagination</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/codeigniter-from-scratch-day-8-ajax/" target="_blank">Day 8: AJAX</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/codeigniter-from-scratch-file-uploading-and-image-manipulation/" target="_blank">Day 9: File Uploading and Image Manipulation</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/codeigniter-from-scratch-the-calendar-library/" target="_blank">Day 10: The Calendar Library</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/codeigniter-from-scratch-file-operations/" target="_blank">Day 11: File and Directory Operations</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/codeigniter-from-scratch-shopping-cart/" target="_blank">Day 12: Shopping Cart</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/codeigniter-from-scratch-extending-the-framework/" target="_blank">Day 13: Extending the Framework</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/codeigniter-from-scratch-security/" target="_blank">Day 14: Security</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/codeigniter-from-scratch-profiling-benchmarking-hooks/" target="_blank">Day 15: Profiling, Benchmarking &amp; Hooks</a></li>
</ul>
<h2>Other Sample CodeIgniter Tutorials Worth Reviewing</h2>
<ul>
<li><a  href="http://net.tutsplus.com/tutorials/php/building-an-rss-2-0-feed-with-codeigniter/" target="_blank">Build an RSS 2.0 Feed with CodeIgniter</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/" target="_blank">Working with RESTful Services in CodeIgniter</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/basecamp-style-subdomains-with-codeigniter/" target="_blank">Basecamp Style Subdomains With CodeIgniter</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/creating-a-file-hosting-site-with-codeigniter/" target="_blank">Creating a File Hosting Site with CodeIgniter</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/how-to-build-a-shopping-cart-using-codeigniter-and-jquery/" target="_blank">How to Build a Shopping Cart using CodeIgniter and jQuery</a></li>
<li><a  href="http://net.tutsplus.com/tutorials/php/how-to-update-your-twitter-status-with-codeigniter/" target="_blank">How to Update your Twitter Status with CodeIgniter</a></li>
</ul>
<p><strong>All of these CodeIgniter Tutorials are provided for free by <a  href="http://tutsplus.com/amember/go.php?r=46623&#038;i=b4" target="_blank">NetTuts.com</a>. Share your favorite CodeIgniter Tutorials in the comments below.</strong></p>


<br clear="all"><p>Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-short-url-redirect-example/54427/' rel='bookmark' title='CodeIgniter Short URL Redirect Example'>CodeIgniter Short URL Redirect Example</a></li>
<li><a href='http://www.gotphp.com/codeigniter-with-zend-framework-libraries/54312/' rel='bookmark' title='CodeIgniter with Zend Framework Libraries'>CodeIgniter with Zend Framework Libraries</a></li>
<li><a href='http://www.gotphp.com/storing-codeigniter-session-data-to-a-database/54471/' rel='bookmark' title='Storing Codeigniter Session Data to a Database'>Storing Codeigniter Session Data to a Database</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/gotphp/~4/hLIdXImZaA4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gotphp.com/top-codeigniter-tutorials-for-new-codeigniter-developers/54511/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.gotphp.com/top-codeigniter-tutorials-for-new-codeigniter-developers/54511/</feedburner:origLink></item>
		<item>
		<title>Storing Codeigniter Session Data to a Database</title>
		<link>http://feedproxy.google.com/~r/gotphp/~3/gkuQvHihtNk/</link>
		<comments>http://www.gotphp.com/storing-codeigniter-session-data-to-a-database/54471/#comments</comments>
		<pubDate>Sat, 30 Oct 2010 04:57:08 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[codeigniter database]]></category>
		<category><![CDATA[codeigniter form]]></category>
		<category><![CDATA[codeigniter sessions]]></category>
		<category><![CDATA[codeigniter tutorial]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sessions]]></category>

		<guid isPermaLink="false">http://www.gotphp.com/?p=471</guid>
		<description><![CDATA[<p>One of the interesting things about CodeIgniter is how it creates and handles sessions. CodeIgniter doesn’t use native PHP sessions. Instead it uses a cookie to store the serialized data. This method, according to the guide, offers more flexibility for developers.</p> <p>In this example we’re going to try out the CI session class, and explore [...]

<br clear="all">
Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-file-upload-and-email-example/54438/' rel='bookmark' title='CodeIgniter File Upload And Email Example'>CodeIgniter File Upload And Email Example</a></li>
<li><a href='http://www.gotphp.com/codeigniter-multiple-database-support/5468/' rel='bookmark' title='CodeIgniter with Multiple Database Support'>CodeIgniter with Multiple Database Support</a></li>
<li><a href='http://www.gotphp.com/codeigniter-profiler-extended/54358/' rel='bookmark' title='CodeIgniter Profiler Extended'>CodeIgniter Profiler Extended</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>One of the interesting things about CodeIgniter is how it creates and handles sessions. CodeIgniter doesn’t use native PHP sessions. Instead it uses a cookie to store the serialized data. This method, according to the guide, offers more flexibility for developers.</p>
<p>In this example we’re going to try out the CI session class, and explore storing session data in a database. We’ll use a simple ordering form to capture information, and play around the settings to get some pretty interesting results.</p>
<h2><strong>STEP 1: Configure CodeIgniter </strong></h2>
<p>Autoloading helpers and libraries is one of the ways CI helps simplify application development. So go ahead and load the&nbsp; database and session library on your config/autoload.php file . While we’re here, load the form and url helpers as well.</p>
<pre class="brush: php">
$autoload[&#039;libraries&#039;] = array(&#039;database&#039;, &#039;session&#039;);
$autoload[&#039;helper&#039;] = array(&#039;form&#039;, &#039;url&#039;);
</pre>
<p>On the same config folder, open up the config.php file and set up CI for saving session data to a database.</p>
<p>You want to look for:</p>
<pre class="brush: php">
$config[&#039;sess_use_database&#039;]&amp;nbsp;= TRUE;
</pre>
<p>Make sure to change that to TRUE. You can also specify the name of the database you want to use for your session data. Just look for:</p>
<pre class="brush: php">
$config[&#039;sess_table_name&#039;]&amp;nbsp;= &#039;ci_sessions&#039;;
</pre>
<p>By default the database is named <strong>ci_sessions</strong>, and that&#8217;s the name we&#8217;re going to use to create our database later on.</p>
<p>Now for this demonstration, we’re going to play around with the session expiration. So look for the line:</p>
<pre class="brush: php">
$config[&#039;sess_expiration&#039;]&amp;nbsp;= 7200;
</pre>
<p>Set the session expiration to 2 seconds. Normally, the session is set to expire in 2 days or 7200 seconds. But for this activity we want make multiple entries to our session database. So every two seconds the session expires and a new one can be created when the user submits new data from our ordering form.</p>
<h2><strong>STEP 2: Build the Database</strong></h2>
<p>Now that we have our config files set. Lets proceed to building our database. The CI user guide provides and excellent example of the basic prototype we can use for our database:</p>
<pre class="brush: php">
CREATE TABLE IF NOT EXISTS&amp;nbsp; `ci_sessions` (
session_id varchar(40) DEFAULT &#039;0&#039; NOT NULL,
ip_address varchar(16) DEFAULT &#039;0&#039; NOT NULL,
user_agent varchar(50) NOT NULL,
last_activity int(10) unsigned DEFAULT 0 NOT NULL,
user_data text NOT NULL,
PRIMARY KEY (session_id)
);
</pre>
<p>Go ahead and take a look at the database table that was created. Inside the ci_sessions table you&#8217;ll see five fields:</p>
<ol>
<li>session_id</li>
<li>ip_address</li>
<li>user_agent</li>
<li>last_activity</li>
<li>user_data</li>
</ol>
<p>The user_data field is where our custom data will be stored later on.</p>
<h2><strong>STEP 3: Create the Form</strong></h2>
<p>Ok, we’ve got our database ready. Lets take it for a spin by building a simple ordering form. In our views folder, you want to create sessionexample.php file with the following code:</p>
<pre class="brush: php">
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;
&amp;lt;title&amp;gt;Order Form&amp;lt;/title&amp;gt;
&amp;lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;&amp;lt;?php echo base_url();?&amp;gt;css/style.css&quot; &amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
&amp;lt;h5&amp;gt;Fruity Orders&amp;lt;/h5&amp;gt;
&amp;lt;?php
$attributes = array(
&#039;name&#039; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; &#039;orderform&#039;
, &#039;id&#039; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; &#039;orderform&#039;
);
echo form_open(&#039;sessionexample/process&#039;, $attributes);

echo form_label(&#039;Order for: &#039;, &#039;ordername&#039;);
echo form_input(&#039;ordername&#039;).&#039;&amp;lt;br /&amp;gt;&#039;;

echo form_label(&#039;How Many: &#039;, &#039;quantity&#039;);
$data = array(
&#039;name&#039; =&amp;gt; &#039;quantity&#039;
, &#039;id&#039; =&amp;gt; &#039;quantity&#039;
, &#039;maxlength&#039; =&amp;gt; &#039;2&#039;
, &#039;size&#039; =&amp;gt; &#039;1&#039;
);
echo form_input($data).&#039; &#039;;

echo form_label(&#039;Choose Item &#039;, &#039;choice&#039;);
$options = array(
&#039;apples&#039; =&amp;gt; &#039;Apples&#039;
, &#039;oranges&#039; =&amp;gt; &#039;Oranges&#039;
, &#039;pears&#039; =&amp;gt; &#039;Pears&#039;
);
echo form_dropdown(&#039;choice&#039;, $options, &#039;apples&#039;).&#039;&amp;lt;br /&amp;gt;&#039;;

echo form_submit(&#039;submit&#039;, &#039;Send My Order&#039;);
echo form_close();

echo (isset($message) ? &quot;&amp;lt;div class=&#039;message&#039;&amp;gt;&quot;.$message.&quot;&amp;lt;/div&amp;gt;&quot; : NULL);
?&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
</pre>
<h2><strong>STEP 4: Create the Controller</strong></h2>
<p>Now for the fun part. Create a file called sessionexample.php in the controllers folder. Inside it, we’re going to catch the data as the user submits his order, then store the data into our session using flashdata.</p>
<pre class="brush: php">
class Sessionexample extends MY_Controller {
function __construct(){
parent::__construct();
}

function index(){
$this-&amp;gt;load-&amp;gt;view(&#039;sessionexample&#039;);
}

function process(){
$values = array(
&#039;ordername&#039; &amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; $this-&amp;gt;input-&amp;gt;post(&#039;ordername&#039;)
, &#039;quantity&#039; &amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; $this-&amp;gt;input-&amp;gt;post(&#039;quantity&#039;)
, &#039;choice&#039; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; $this-&amp;gt;input-&amp;gt;post(&#039;choice&#039;)
);
$this-&amp;gt;session-&amp;gt;set_flashdata($values);

$data[&#039;message&#039;] &amp;nbsp;&amp;nbsp; &amp;nbsp;= &quot;You ordered &quot;.$values[&#039;quantity&#039;];
$data[&#039;message&#039;] &amp;nbsp;&amp;nbsp; &amp;nbsp;.= &quot; &quot;.$values[&#039;choice&#039;].&quot; for &quot;.$values[&#039;ordername&#039;].&quot;.&quot;;

$this-&amp;gt;load-&amp;gt;view(&#039;sessionexample&#039;, $data);
}
}
</pre>
<p>Notice that after storing the user data, we retrieve it from the session object and send it back to our view as feedback for the user. You can take the application for a spin now or finish off with some styles.&nbsp; After as the session is created, CI automatically stores the information to our database. Since we tweaked the session expiration to 2 seconds, you can make multiple database entries to observe how CI stores the information.</p>
<h2><strong>STEP 5 (Optional): Finish with style </strong></h2>
<p>Let’s polish off our web application with styling. We’re also going to link a style sheet to our order form:</p>
<pre class="brush: php">
&amp;lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;&amp;lt;?php echo base_url();?&amp;gt;css/style.css&quot; &amp;gt;
</pre>
<p>Go ahead and create style.css where we’re going to place the following styles:</p>
<pre class="brush: php">
body {
background: #EFB4B3;
margin: 0; padding: 0;
font-family: arial;
}

#orderform {
border: 1px solid black;
margin: 15px auto 0; padding: 1em;
width: 350px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}

.message {
background: #FFFFCC;
margin: 15px auto 0; padding: 1em;
width: 350px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}

h5 {
color: #336699;
font-size:24px; font-weight:bold;
margin-bottom: 2px;
text-align: center;
}

input[type=text], select {
margin: 0 0 1em 0; padding: 2px;
width: auto;
border: 5px;
font-size:14px;
-moz-border-radius: 1px;
-webkit-border-radius: 1px;
}

input[type=submit]{
background: #3399FF;
border: none;
padding: 6px;
text-decoration: none;
color: white; font-size: 12px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}

input[type=submit]:hover{
background: #0099CC;
cursor: pointer;
}
</pre>
<p>There you have it, a quick and simple demo on how to store CodeIgniter Session Data on a database.</p>
<div style="width: 1px;height: 1px;overflow: hidden">sessionexample</div>
<p><script type="text/javascript" src="http://forms.aweber.com/form/32/159230832.js"></script></p>
<p><strong>If you found this article useful, please share your comments below.</strong></p>


<br clear="all"><p>Related posts:<ol><li><a href='http://www.gotphp.com/codeigniter-file-upload-and-email-example/54438/' rel='bookmark' title='CodeIgniter File Upload And Email Example'>CodeIgniter File Upload And Email Example</a></li>
<li><a href='http://www.gotphp.com/codeigniter-multiple-database-support/5468/' rel='bookmark' title='CodeIgniter with Multiple Database Support'>CodeIgniter with Multiple Database Support</a></li>
<li><a href='http://www.gotphp.com/codeigniter-profiler-extended/54358/' rel='bookmark' title='CodeIgniter Profiler Extended'>CodeIgniter Profiler Extended</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/gotphp/~4/gkuQvHihtNk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gotphp.com/storing-codeigniter-session-data-to-a-database/54471/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.gotphp.com/storing-codeigniter-session-data-to-a-database/54471/</feedburner:origLink></item>
		<item>
		<title>My Top Places to Find The Best PHP Jobs Online</title>
		<link>http://feedproxy.google.com/~r/gotphp/~3/lAfN8n7jrBw/</link>
		<comments>http://www.gotphp.com/my-top-places-to-find-the-best-php-jobs-online/54457/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 17:36:07 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[PHP Jobs]]></category>
		<category><![CDATA[local php jobs]]></category>
		<category><![CDATA[php developer jobs]]></category>
		<category><![CDATA[php job board]]></category>
		<category><![CDATA[php jobs]]></category>
		<category><![CDATA[remote php jobs]]></category>

		<guid isPermaLink="false">http://www.gotphp.com/?p=457</guid>
		<description><![CDATA[<p>At some point in your php development career, you will have to go out and find a new job. Thankfully there are a lot of php developer jobs out there for you to choose from, however the best php jobs are spread across just a few key php job boards.</p> <p>These are my top 4 [...]


]]></description>
			<content:encoded><![CDATA[<p>At some point in your php development career, you will have to go out and find a new job. Thankfully there are a lot of php developer jobs out there for you to choose from, however the best php jobs are spread across just a few key php job boards.</p>
<p><strong>These are my top 4 places to find the best php jobs online…</strong></p>
<h2>#1 &#8211; 37signals Job board</h2>
<p><a  href="http://gotphp.com/go/37signals" target="_blank"><img class="alignleft size-full wp-image-461" title="37signals Job Board" src="http://www.gotphp.com/wp-content/gotphp-uploads/37signals.jpg" alt="" width="200" height="150" /></a></p>
<p>The 37singals job board has a sub-section for programming jobs and you can easily filter that down to jobs in php. <strong>The cost to post a php job here is very high so most recruiters don&#8217;t use it.</strong> This is good for you because the companies that do use it are serious about looking for the best php developers directly.</p>
<p>Searching for PHP resulted in only 30 matches with several locations listed as &#8220;Anywhere&#8221;, which is great for <strong>php developers who like to work remotely</strong>!</p>
<p><em>Note &#8212; This is where I found one of my best clients that I have been consulting with for over a year now. They are based out of North Carolina and I am in Louisville, Kentucky.</em></p>
<p>RSS Feed: <a  href="http://jobs.37signals.com/categories/2/jobs.rss" target="_blank">http://jobs.37signals.com/categories/2/jobs.rss</a></p>
<h2>#2 &#8212; SimplyHired &#8211; Job Search Made Simple (I agree)</h2>
<p><a  href="http://gotphp.com/go/simplyhired" target="_blank"><img class="alignleft size-full wp-image-460" title="SimplyHired - Job Search Simple Easy" src="http://www.gotphp.com/wp-content/gotphp-uploads/simplyhired.jpg" alt="" width="200" height="150" /></a></p>
<p>The SimplyHired job board is probably the number one aggregated job board online today. Their searching, sorting, &amp; location filters are hard to be beat for sure, <strong>however the results are not always as they appear</strong>.</p>
<p>A simple search for PHP returns over 17,000 listings with includes many health related jobs like &#8220;CLINICAL INSTRUCTOR &#8211; PHP/IOP&#8221; so you have to filter that crap out.</p>
<p><strong>Be warned though that most of the listings on this site are created by recruiters and head hunters, not the real companies looking for php developers directly.</strong> This means that the recruiters will pre-screen you before connecting you with the real company which is not always in your best interest. I&#8217;d much rather talk to the hiring manager than work through a proxy head hunter that has never coded a day in their life!</p>
<p>RSS Feed: <a  href="http://www.simplyhired.com/a/job-feed/rss/q-php/l-louisville,+ky/mi-50" target="_blank">http://www.simplyhired.com/a/job-feed/rss/q-php/l-louisville,+ky/mi-50</a> (Louisville for local to me, replace with your city for local to you.)</p>
<h2>#3 &#8212; Startuply &#8211; Startup Companies, Startup Jobs</h2>
<p><a  href="http://gotphp.com/go/startuply" target="_blank"><img class="alignleft size-full wp-image-459" title="Startuply" src="http://www.gotphp.com/wp-content/gotphp-uploads/startuply.jpg" alt="" width="200" height="150" /></a></p>
<p>Pros &#8211; The concept here is excellent, if you are looking to join a startup. <strong>However the pay is often on par with startup income, which is zero.</strong> A lot of listings want you to work for little to no pay. Get in that sweat equity early!</p>
<p>One of the good things about this site is that the listings are mostly from the companies that are looking for php developers and not recruiters. However I find that <strong>most of their php job listings are often stale and outdated</strong>. They don&#8217;t do a real good job at expiring old listings so your search results are often much less than stated.</p>
<p>Also, most jobs are on-site and in major tech cities so if you don&#8217;t live nearby, then you probably won&#8217;t be landing any of those jobs anytime soon.</p>
<p>RSS Feed: <a  href="http://www.startuply.com/Rss/Search.aspx?s=php" target="_blank">http://www.startuply.com/Rss/Search.aspx?s=php</a></p>
<h2>#4 &#8212; Craigslist &#8211; Local, Local, Local</h2>
<p><a  href="http://gotphp.com/go/craigslist" target="_blank"><img class="alignleft size-full wp-image-458" title="Craigslist" src="http://www.gotphp.com/wp-content/gotphp-uploads/craigslist.jpg" alt="" width="200" height="150" /></a><strong>Craigslist is GREAT for finding local php jobs.</strong> Simply drill down to your city and head over to the jobs section. Search for PHP and you should find several local jobs &#8220;usually&#8221; listed by the actual companies looking for php developers, but not always. So be sure to review each listing thoroughly.</p>
<p>RSS Feed: <a  href="http://louisville.craigslist.org/search/jjj?query=php&#038;format=rss" target="_blank">http://louisville.craigslist.org/search/jjj?query=php&amp;format=rss</a> (Louisville for local to me, replace with your city for local to you.)</p>
<p><br clear="all" /></p>
<p>I know there are a lot of other php job boards our there and probably many more places to find php developer jobs online, so please <strong>share your favorite php job board with everyone in your comments below</strong>. Thanks!</p>


<p></p><img src="http://feeds.feedburner.com/~r/gotphp/~4/lAfN8n7jrBw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gotphp.com/my-top-places-to-find-the-best-php-jobs-online/54457/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.gotphp.com/my-top-places-to-find-the-best-php-jobs-online/54457/</feedburner:origLink></item>
	</channel>
</rss>

