<?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 Magic Book - Free PHP Scripts, Tutorials and Downloads &#187; array</title>
	<atom:link href="http://www.phpmagicbook.com/tag/array/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpmagicbook.com</link>
	<description>PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips</description>
	<lastBuildDate>Tue, 15 Jun 2010 13:22:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Get Data As An Array &#8211; Download PHP Example</title>
		<link>http://www.phpmagicbook.com/get-data-as-an-array-download-php-example/</link>
		<comments>http://www.phpmagicbook.com/get-data-as-an-array-download-php-example/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 18:38:22 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Arrays]]></category>
		<category><![CDATA[For Loop]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[Loops]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=167</guid>
		<description><![CDATA[Array &#038; Loop Example Suppose we have a form and we want from user to select from a list of check boxes and check his favorite choices, post that data as an array and we want to display that data by calling array and arranging it in a loop. Then for this purpose consider following [...]<p><a href="http://www.phpmagicbook.com/get-data-as-an-array-download-php-example/">Get Data As An Array &#8211; Download PHP Example</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<h4>Array &#038; Loop Example</h4>
<p>Suppose we have a form and we want from user to select from a list of check boxes and check his favorite choices, post that data as an array and we want to display that data by calling array and arranging it in a loop. Then for this purpose consider following example.</p>
<p><span id="more-237"></span></p>
<h4>Form Code</h4>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p&gt;Arrays example&lt;/p&gt;
&lt;p&gt;Check your favorite Movies:
&lt;/p&gt;
&lt;form action=&quot;nextpagename.php&quot; method=&quot;post&quot; name=&quot;array-form&quot; id=&quot;array-form&quot;&gt;
  &lt;p&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;Harry Potter&quot;&gt;
    Harry Potter&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;The Hobbit&quot;&gt;
    The Hobbit&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;Lord Of Rings&quot;&gt;
    Lord Of Rings&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;Matrix&quot;&gt;
    Matrix&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;Happy Feet&quot;&gt;
    Happy Feet&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;The Hell Boy&quot;&gt;
    The Hell Boy&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;Hulk&quot;&gt;
    Hulk&lt;/p&gt;
  &lt;p&gt;
    &lt;label&gt;
    &lt;input type=&quot;submit&quot; name=&quot;button&quot; id=&quot;button&quot; value=&quot;Submit&quot;&gt;
    &lt;/label&gt;
&lt;/p&gt;
&lt;/form&gt;</pre></div></div>

<h4>PHP Code &#8211; Retrieve Data From Array and Display It Through A Loop</h4>

<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;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pick'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$displaydata</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pick'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$displaydata</span>&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>In the above example we have collected the data from check boxes in form of arrays named as <strong>pick[]</strong> and we have sent it to another PHP page where it is displayed through a for loop.</p>
<p><a href='http://www.phpmagicbook.com/wp-content/uploads/2008/06/array-example.rar' class="download">PHP Arrays Example Download</a></p>
<p><a href="http://www.phpmagicbook.com/get-data-as-an-array-download-php-example/">Get Data As An Array &#8211; Download PHP Example</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/php-for-loop/" title="PHP For Loop">PHP For Loop</a></li><li><a href="http://www.phpmagicbook.com/php-arrays/" title="PHP Arrays">PHP Arrays</a></li><li><a href="http://www.phpmagicbook.com/php-for-each-loop/" title="PHP ForEach Loop">PHP ForEach Loop</a></li><li><a href="http://www.phpmagicbook.com/php-do-while-loop/" title="PHP Do While Loop">PHP Do While Loop</a></li><li><a href="http://www.phpmagicbook.com/php-while-loop/" title="PHP While Loop">PHP While Loop</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/get-data-as-an-array-download-php-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
