<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Php Development &#187; CodeIgniter</title>
	<atom:link href="http://www.maheshchari.com/category/codeigniter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maheshchari.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 17 Jan 2012 02:42:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>codeigniter form_dropdown</title>
		<link>http://www.maheshchari.com/codeigniter-form_dropdown/</link>
		<comments>http://www.maheshchari.com/codeigniter-form_dropdown/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 22:12:45 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=622</guid>
		<description><![CDATA[How to make a select box or form drop down menu using codeiginter. We already know that the codeignter is best PHP framework ,library and a simple cms. a lot of people agree that codeigniter is library. we discussed some features of codeiginter. Now we are going to learn how to make a select box [...]]]></description>
			<content:encoded><![CDATA[<h1>How to make a select box or form drop down menu using codeiginter.<br />
</h1>
<p>We already know that the <strong>codeignter</strong> is best PHP <strong>framework</strong> ,library and a simple <strong>cms</strong>. a lot of people agree that <strong>codeigniter</strong> is library. we discussed some features of <strong>codeiginter</strong>. Now we are going to learn how to make a select box aka form <strong>drop down menu</strong> using <strong>codeigniter</strong>. There is so many ways to make this <strong>select box</strong> using <strong>codeigniter</strong> php <strong>framework</strong>. Good news is that <strong>codeigniter</strong> released version 2 with lot of features also,unfortunately it supports PHP 5 only. </p>
<p>We can make the select box with <strong>codeigniter framework</strong> in <strong>three</strong> ways:</p>
<ul>
<li>Directly inputing the associative array to <strong>form_dropdown</strong> codeigniters HTML helper function. </li>
<li>Directly inputing an indexed array to <strong>form_dropdown</strong> codeigniters HTML helper function. </li>
<li>HTML PHP parsing mechanism,with template without <strong>form_dropdown</strong> function. </li>
</ul>
<p>I think all of us know about the type of arrays in php , nevermind letus know a bit cause some of us <strong>no</strong> alteast one of us dont know. </p>
<p>According to the elements types with array we categorised <strong>associate array</strong>,<strong> indexed array</strong>,<strong> mixed array</strong>. </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">		<span style="color: #000088;">$options1</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//assoc array</span>
		<span style="color: #000088;">$options2</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'op1'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton1'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op2'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton2'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op3'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton3'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//mixed array contains indexed and assoc array elements</span>
		<span style="color: #000088;">$options3</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'op1'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton1'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op2'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton2'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//associative  array</span>
		<span style="color: #000088;">$options4</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'op1'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton1'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op2'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton2'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op3'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton3'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//this rang function will return 3,4,5 elements indexed array</span>
        <span style="color: #000088;">$options</span><span style="color: #339933;">=</span><span style="color: #990000;">range</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>A mixed array can contain not only different keys ,can also have different type of elements also <img src='http://www.maheshchari.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>form_dropdown</strong> has basically four input parameters. </p>
<ol>
<li>param1: name the select box or drop down box, it is string.</li>
<li>param2: any indexed or associative array</li>
<li>param3: default selected options in select box with array format</li>
<li>param4: this is the string which can be printed on selecte box attributes directly. </li>
</ol>
<p>Even though <strong>form_dropdown</strong> has four parameters, we must pass alteast two parameters param1 and param2.</p>
<p>Before going to start our example we must know codeignite MVC mechanism, atleast about controller. no problem we see all examples in single controller called <strong>select.php</strong> and i provided inline comments that will help us .</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Select <span style="color: #000000; font-weight: bold;">extends</span> CI_Controller <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//indexed array</span>
		<span style="color: #000088;">$options1</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//assoc array</span>
		<span style="color: #000088;">$options2</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'op1'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton1'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op2'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton2'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op3'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton3'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//mixed array contains indexed and assoc array elements</span>
		<span style="color: #000088;">$options3</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'op1'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton1'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op2'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton2'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//assoc array</span>
		<span style="color: #000088;">$options4</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'op1'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton1'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op2'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton2'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op3'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'opton3'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//add one more element</span>
		<span style="color: #000088;">$options4</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'op4'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'option4'</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//creates dynamic indexed array from 3 to 5 values </span>
		<span style="color: #000088;">$options</span><span style="color: #339933;">=</span><span style="color: #990000;">range</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//array elements which are selected by default , these are keys of the options array</span>
		<span style="color: #000088;">$selected_opt</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'op1'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op3'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$selected_opt2</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//adding extra HTML attributes to form drop down with a string</span>
		<span style="color: #000088;">$extra_attributes1</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'id=&quot;dropy&quot; style=&quot;color:blue;&quot;'</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> form_dropdown<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'drop1'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> form_dropdown<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'drop2'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;&lt;br/&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> form_dropdown<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'drop3'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;&lt;br/&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> form_dropdown<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'drop4'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;&lt;br/&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> form_dropdown<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'drop5'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;&lt;br/&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> form_dropdown<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'drop6'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options2</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'op3'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;&lt;br/&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> form_dropdown<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'drop7'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options2</span><span style="color: #339933;">,</span><span style="color: #000088;">$selected_opt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;&lt;br/&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> form_dropdown<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'drop8'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options2</span><span style="color: #339933;">,</span><span style="color: #000088;">$selected_opt</span><span style="color: #339933;">,</span><span style="color: #000088;">$extra_attributes1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;&lt;br/&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> form_dropdown<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'drop9'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options2</span><span style="color: #339933;">,</span><span style="color: #000088;">$selected_opt</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'id=&quot;dropu&quot; onclick=&quot;alert(\'you changed options!!\');&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;&lt;br/&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> form_dropdown<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'drop9'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options2</span><span style="color: #339933;">,</span><span style="color: #000088;">$selected_opt</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'id=&quot;dropu&quot; size=2'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;&lt;br/&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'select'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* End of file select.php */</span>
<span style="color: #666666; font-style: italic;">/* Location: ./application/controllers/select.php */</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href='http://www.maheshchari.com/wp-content/uploads/2011/02/application.zip'>Download Source Code</a></p>
<p>Installation and testing: please download the source code from above link and extract the zip file and paste the application folder in you <strong>codeiginter</strong> folder ,it ask for replace the folder ,just replace and test the package with following URL in your local server. this url is without  <a href="http://www.maheshchari.com/codeigniter-htaccess/" target="_blank">SEF htacces</a>. </p>
<p>http://localhost/index.php/select/</p>
<p>&nbsp;</p>
<p><a href="http://www.maheshchari.com/wp-content/uploads/2011/02/application.zip"><img src="http://www.maheshchari.com/wp-content/uploads/2011/01/source-code.png" alt="Download Source Code" title="source-code" width="150" height="121" class="size-full wp-image-598" /></a></p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=622&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/codeigniter-form_dropdown/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Codeigniter htaccess</title>
		<link>http://www.maheshchari.com/codeigniter-htaccess/</link>
		<comments>http://www.maheshchari.com/codeigniter-htaccess/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 06:07:26 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[htaccess]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=423</guid>
		<description><![CDATA[Enable SEF URL in Codeigniter We are familiar with Codeigniter comes with optional SEF URLs, but we use non SEF urls in production or development version. 1 2 http://localhost/index.php/helloworld/welcome/ http://localhost/helloworld/welcom/ In the above snippet we know that line 1 is default URL which contains index.php in URl part that used in development version. Second line [...]]]></description>
			<content:encoded><![CDATA[<h1>Enable SEF URL in Codeigniter</h1>
<p>We are familiar with Codeigniter comes with optional SEF URLs, but we use non SEF urls in production or development version.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">http://localhost/index.php/helloworld/welcome/
http://localhost/helloworld/welcom/</pre></td></tr></table></div>

<p>In the above snippet we know that line 1 is default URL which contains index.php in URl part that used in development version.<br />
Second line is the deployed version SEF URL, generally we need some tweaks with .htaccess and configure stuff. </p>
<h3>htaccess</h3>
<p>Open note pad and copy and paste below code into that and save it as <b>.htaccess</b> and copy this file into your codeigniters root directory where it was installed.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]</pre></td></tr></table></div>

<p><b>Line 1:</b>  set index.php as default directory index instead of index.html </p>
<p><b>Line 2:</b>  Start rewriting engine on</p>
<p><b>Line 3:</b>  start a condition that won&#8217;t meet this situation where the request to static resources like images , css, javascript , robot text files  </p>
<p><b>Line 4:</b>  make condition user requests a valid request</p>
<p><b>Line 5:</b>  make condition no physical file exists with the given URL</p>
<p><b>Line 6:</b>  if above conditions all met redirect the request to index.php on installation </p>
<h3>making changes to config.php  file</h3>
<p>open the file in the directory <b>system/application/config/config.php </b> make following changes.<br />
Find below line</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'index_page'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;index.php&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Replace above line with below code</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'index_page'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now test the new URLs ,it done.</p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=423&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/codeigniter-htaccess/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>codeigniter anchor</title>
		<link>http://www.maheshchari.com/codeigniter-anchor/</link>
		<comments>http://www.maheshchari.com/codeigniter-anchor/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 03:54:38 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=354</guid>
		<description><![CDATA[How to make a link using Codeigniter. Here we learn how to use anchor method that is URL helper of Codeigniter.We already discussed in my previous post URL structure of Codeigniter. It creates a anchor tag in HTML view. We can create anchor links in two ways. by using anchor function available in URL helper [...]]]></description>
			<content:encoded><![CDATA[<h1>How to make a link using Codeigniter. </h1>
<p>Here we learn how to use anchor method  that is URL helper of Codeigniter.We already discussed in my <a href="http://www.maheshchari.com/codeigniter-url-helper-part1/" target="_blank">previous post</a> URL structure of Codeigniter. It creates a anchor tag in HTML view.</p>
<p>We can create anchor links in two ways. </p>
<ul>
<li>by using anchor function available in URL helper of Codeigniter.</li>
<li>by using site_url function available in URL helper of Codeigniter.  </li>
</ul>
<h3>Below examples shows how to make HTML link Using anchor function </h3>
<p>anchor tag with two parameters,parameter 1 takes segments of the targe page,parameter 2 takes link text. </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>  
<span style="color: #b1b100;">echo</span> anchor<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'controller/method/parameter1'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Link Text'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// &lt;a href=&quot;http://example.com/index.php/controller/method/parameter1&quot;&gt;Link Text&lt;/a&gt;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>anchor tag with additional attributes like title </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>  
<span style="color: #b1b100;">echo</span> anchor<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'controller/method/parameter1'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Link  with Title attribute'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Link Title'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// &lt;a href=&quot;http://example.com/index.php/controller/method/parameter1&quot; title=&quot;Link Title&quot;&gt;Link  with Title attribute&lt;/a&gt;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>anchor tag with javascript attribute. </p>
<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>  
<span style="color: #b1b100;">echo</span> anchor<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'controller/method/parameter1'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Link  with Title and javascript'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Link Title'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'onclick'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;alert('hi');return false;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//&lt;a href=&quot;http://example.com/index.php/controller/method/parameter1&quot; title=&quot;Link Title&quot; onclick=&quot;alert('hi');return false;&quot;&gt;Link  with Title and javascript&lt;/a&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

</p>
<p>remember anchor tag won&#8217;t create internel page link. </p>
<h3>Below examples show how to make HTML link using site_url function </h3>
<p>We can use site_url output as href attribute and can make internel links also. </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;p&gt;&lt;a href=&quot;&lt;?php echo site_url('controller/method/parameter1'); ?&gt;&quot;&gt;with site_url function &lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;&lt;?php echo site_url('controller/method/parameter1'); ?&gt;&quot; title=&quot;link title&quot;&gt;with site_url function and title attribute &lt;/a&gt;&lt;/p&gt;</pre></td></tr></table></div>

<h3>Test it in your local system</h3>
<p>To test these functions ,just <a href='http://www.maheshchari.com/wp-content/uploads/2009/08/anchor_example.zip' title="anchor tag source code">download</a> the example files and paste into your codeigniter root directory. run the example.</p>
<p>if you have any queries you can mail me. </p>
<h3>Preview</h3>
<p><a href="http://www.maheshchari.com/wp-content/uploads/2009/08/codeigniter_anchor_tag.jpg"><img src="http://www.maheshchari.com/wp-content/uploads/2009/08/codeigniter_anchor_tag-300x173.jpg" alt="codeigniter_anchor_tag" title="codeigniter_anchor_tag" width="300" height="173" class="alignnone size-medium wp-image-361" /></a></p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=354&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/codeigniter-anchor/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>codeigniter url helper 1</title>
		<link>http://www.maheshchari.com/codeigniter-url-helper-part1/</link>
		<comments>http://www.maheshchari.com/codeigniter-url-helper-part1/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 02:09:12 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=344</guid>
		<description><![CDATA[Here we discuss about the codeigniter URL structur. Codeigniter mainly preferes search engine freindly. that is segmented method. by default it won&#8217;t support get method.you can see my previous post for enabling get method in Codeigniter. It comes with URL helper that has many built in functions helps. To run below examples,we use default welcome [...]]]></description>
			<content:encoded><![CDATA[<p>Here we discuss about the <a href="http://codeigniter.com/" target="_blank">codeigniter</a> URL structur. <strong>Codeigniter</strong> mainly preferes search engine freindly. that is <strong>segmented</strong> method. by default it won&#8217;t support <strong>get</strong> method.you can see my <a href="http://www.maheshchari.com/work-to-get-method-on-codeigniter/" target="_blank">previous post</a> for enabling get method in <strong>Codeigniter</strong>. It   comes with URL helper that has many built in functions helps.</p>
<p>To run below examples,we use default welcome controller and welcome_message view. You can see below image where it <a href="#codeigniterfolderstructure">located</a>.when you run it executes <strong>welcome.php</strong> controller and loads view <strong>welcome_message.php</strong> </p>
<p><strong><a href='http://www.maheshchari.com/wp-content/uploads/2009/08/system.zip'>Codeigniter Download example source code</a></strong></p>
<p>To run below examples,we have to load the URL helper by adding below line to controller constructor. </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>base_url() </strong>returns web site url.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #666666; font-style: italic;">//output is http://example.com/</span>
<span style="color: #b1b100;">echo</span> base_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>
<strong>index_page()</strong> returns the <strong>index_page</strong> in <strong>config</strong> variable.by default it returns index.php.  when you enable mod_write for Codeigniter <strong>index_page</strong> empty. Then base_url and site_url are equal.
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #666666; font-style: italic;">// out put could be index.php</span>
<span style="color: #b1b100;">echo</span> index_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>site_url()</strong> return base_url with <strong>index_page</strong> in config variable. That is <strong>index.php</strong> by default. </p>
<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #666666; font-style: italic;">//output could be http://example.com/index.php</span>
<span style="color: #b1b100;">echo</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

</p>
<p><strong>site_url()</strong> takes two kinds of parameters either a <strong>string of segmets</strong> or array of segments. </p>
<p>Below example takes string of segments as a parameter. </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #666666; font-style: italic;">//output could be http://example.com/index.php/desired_controller/controller_method</span>
<span style="color: #b1b100;">echo</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/desired_controller/controller_method'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//out put could be http://example.com/index.php/desired_controller/controller_method/parameter1/parameter2 </span>
<span style="color: #b1b100;">echo</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/desired_controller/controller_method/parameter1/parameter2'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>
Below example takes array of segments as a parameter. be aware that precedence importence.
</p>
<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #000088;">$segments</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'desired_controller'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'controller_method'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'parameter1'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'parameter2'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$segments</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//out put could be http://example.com/index.php/desired_controller/controller_method/parameter1/parameter2 ?&gt;</span></pre></td></tr></table></div>

</p>
<h3>Codeigniter site folder structure</h3>
<p><a name="codeigniterfolderstructure" id="codeigniterfolderstructure"><a href="http://www.maheshchari.com/wp-content/uploads/2009/08/codeigniter_folder_structure.jpg"><img src="http://www.maheshchari.com/wp-content/uploads/2009/08/codeigniter_folder_structure-193x300.jpg" alt="codeigniter_folder_structure" title="codeigniter_folder_structure" width="193" height="300" class="alignnone size-medium wp-image-350" /></a></a></p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=344&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/codeigniter-url-helper-part1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>css image rollover</title>
		<link>http://www.maheshchari.com/css-image-rollover/</link>
		<comments>http://www.maheshchari.com/css-image-rollover/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 17:25:05 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=210</guid>
		<description><![CDATA[image rollover effect with css background image Here we use basic css back ground image to get rollover effect.the logic is simple and we can find it in comments in script itself. we create a empty link set back ground as test1.jpg and display to block and height and width to 150px. build a suido [...]]]></description>
			<content:encoded><![CDATA[<h1>image rollover effect with css background image </h1>
<p>Here we use basic css back ground image  to get rollover effect.the logic is simple and we can find it in comments in script itself.</p>
<ul>
<li>we create a empty link </li>
<li> set back ground as test1.jpg and display to block and height and width to 150px. </li>
<li>build a suido selctor hover to link and set back ground image to test2.jpg </li>
<li>this works even javascript disabled browsers also </li>
</ul>
<h3>Download Script</h3>
<p><a href='http://www.maheshchari.com/wp-content/uploads/2009/06/image-rollover-css.zip'>image-rollover-css</a></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;image rollover with css&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;!--
#imagerollover a {
	background-image: url(test2.JPG);
	display: block;
	background-repeat: no-repeat;
	height: 150px;
	width: 150px;
}
#imagerollover a:hover{
	background-image: url(test1.JPG);
}
--&gt;
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;imagerollover&quot;&gt;&lt;a href=&quot;#test&quot;&gt;&amp;nbsp;&lt;/a&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<h3>Download Script</h3>
<p><a href='http://www.maheshchari.com/wp-content/uploads/2009/06/image-rollover-css.zip'>image-rollover-css</a></p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=210&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/css-image-rollover/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Work To GET method on CodeIgniter</title>
		<link>http://www.maheshchari.com/work-to-get-method-on-codeigniter/</link>
		<comments>http://www.maheshchari.com/work-to-get-method-on-codeigniter/#comments</comments>
		<pubDate>Wed, 06 May 2009 15:50:57 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=44</guid>
		<description><![CDATA[Enable GET method on CodeIgniter Frame Work with SEF urls CodeIgniter is a powerful PHP framework with a very small footprint,built for specially PHP coders.It has many advantages like SEF URL ,light weight, high level Security,MVC model ,more libraries . But it has strictly followed SEF segments ,it unsets or delets the global $_GET array [...]]]></description>
			<content:encoded><![CDATA[<h1>Enable GET method on CodeIgniter Frame Work with SEF urls</h1>
<p><a href="http://codeigniter.com/">CodeIgniter</a> is a powerful PHP framework with a very small footprint,built for specially PHP coders.It has many advantages like SEF URL ,light weight, high level Security,MVC model ,more libraries .<br />
But it has strictly followed SEF segments ,it unsets or delets the global <strong>$_GET</strong> array to prevent Security Hacks when it initializes .To Enable or Create Custom GET method<br />
open <strong>config.php</strong> file in <strong>aplications/config/</strong> folder</p>
<p>set uri protocal
<pre> $config['uri_protocol']	= "PATH_INFO";</pre>
<p>code sample</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of &quot;AUTO&quot; works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO'			Default - auto detects
| 'PATH_INFO'		Uses the PATH_INFO
| 'QUERY_STRING'	Uses the QUERY_STRING
| 'REQUEST_URI'		Uses the REQUEST_URI
| 'ORIG_PATH_INFO'	Uses the ORIG_PATH_INFO
|
*/</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uri_protocol'</span><span style="color: #009900;">&#93;</span>	<span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PATH_INFO&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>add a line of code in your control method to recreate the GET array<br />
for example codeigniter default <strong>welcome.php</strong> controller in Codeigniter</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Welcome <span style="color: #000000; font-weight: bold;">extends</span> Controller <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> Welcome<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		parent<span style="color: #339933;">::</span><span style="color: #004000;">Controller</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>	
		<span style="color: #990000;">parse_str</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//converts query string into global GET array variable</span>
		<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//test the $_GET variables</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'welcome_message'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>if you run your code with following URL</p>
<pre>

http://localhost/index.php/welcome/?var1=1&#038;var2=2&#038;var3=3
</pre>
<p>The result will be</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">Array</span>
<span style="color: #009900;">&#40;</span>
    <span style="color: #009900;">&#91;</span>var1<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span>
    <span style="color: #009900;">&#91;</span>var2<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2</span>
    <span style="color: #009900;">&#91;</span>var3<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3</span>
<span style="color: #009900;">&#41;</span></pre></div></div>

<p>Here <strong> parse_str </strong> function converts string to array with given deliminator.To know more about parse_str go to <a href="http://in.php.net/parse_str">php.net</a><br />
Even though we can achieve this result, i suggest you to stick to segments because it more user friendly.</p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=44&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/work-to-get-method-on-codeigniter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

