<?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>CodingCereal</title>
	<atom:link href="http://www.codingcereal.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codingcereal.com</link>
	<description>Your daily web habit</description>
	<lastBuildDate>Fri, 27 Aug 2010 18:10:02 +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>Introduction to SEO</title>
		<link>http://www.codingcereal.com/2010/08/introduction-to-seo/</link>
		<comments>http://www.codingcereal.com/2010/08/introduction-to-seo/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 18:04:07 +0000</pubDate>
		<dc:creator>Mhaya delos Santos</dc:creator>
				<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://www.codingcereal.com/?p=269</guid>
		<description><![CDATA[SEO or Search Engine Optimization is the process of optimizing a certain website or webpage in the top most viewed <a href="http://www.codingcereal.com/2010/08/introduction-to-seo/">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>SEO or Search Engine Optimization is the process of optimizing a certain website or webpage in the top most viewed sites like Google, Yahoo or MSN thru the usage of specific keywords when searching therefore getting higher ranking within the search results.. In this process,you must need to know at least the basic HTML.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingcereal.com/2010/08/introduction-to-seo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resolving YSlow&#8217;s &#8220;Add Expires headers&#8221; Low Grade</title>
		<link>http://www.codingcereal.com/2010/08/resolving-yslows-add-expires-headers-low-grade/</link>
		<comments>http://www.codingcereal.com/2010/08/resolving-yslows-add-expires-headers-low-grade/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 09:41:12 +0000</pubDate>
		<dc:creator>Jhoy Imperial</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://www.codingcereal.com/?p=261</guid>
		<description><![CDATA[Speed up the loading of your site by caching web site files like images, CSS and javascript files. First time <a href="http://www.codingcereal.com/2010/08/resolving-yslows-add-expires-headers-low-grade/">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Speed up the loading of your  site by caching web site files like images, CSS and javascript files. First time visitors of your site will gonna be making several HTTP requests. The more HTTP requests, the slower your site will load.</p>
<p>I found a good website <a href="http://www.askapache.com/htaccess/apache-speed-expires.html">speed tip</a> that would help make those frequently requested files cacheable.</p>
<p>Using .htaccess you can add the following code add expire headers to your files:</p>
<pre class="brush: php;">&lt;FilesMatch &quot;\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$&quot;&gt;
Header set Expires &quot;Thu, 15 Apr 2011 20:00:00 GMT&quot;
&lt;/FilesMatch&gt;
</pre>
<p><strong>NOTE</strong>: <em>Backup your .htaccess file first before modifying it. </em></p>
<p>Now your site will load up a little bit faster.</p>
<p> <img src='http://www.codingcereal.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px;">&lt;FilesMatch &#8220;\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$&#8221;&gt;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codingcereal.com/2010/08/resolving-yslows-add-expires-headers-low-grade/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP Hash Algorithms</title>
		<link>http://www.codingcereal.com/2010/06/php-hash-algorithms/</link>
		<comments>http://www.codingcereal.com/2010/06/php-hash-algorithms/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 22:06:38 +0000</pubDate>
		<dc:creator>Jhoy Imperial</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://www.codingcereal.com/?p=233</guid>
		<description><![CDATA[A hash is a non-reversible fixed length string typically used to encrypt important data like your passwords to your database. <a href="http://www.codingcereal.com/2010/06/php-hash-algorithms/">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>A hash is a non-reversible fixed length string typically used to encrypt important data like your passwords to your database. MD5 and Sha1 are the most-commonly used hash algorithms used for securing data. But as most developers know, there are already applications that could decrypt these hashes. Thus, we add &#8216;seeds&#8217; or random strings to the password before encrypting them.<br />
<!-- more --><br />
If you are looking for other ways to encrypt your data, you could use the PHP function hash_algos() to see a list of available hash algorithms.</p>
<pre class="brush: php;">print_r(hash_algos());</pre>
<p>The above code would output something like:</p>
<pre class="brush: php;">Array
 (
 [0] =&gt; md4
 [1] =&gt; md5
 [2] =&gt; sha1
 [3] =&gt; sha256
 [4] =&gt; sha384
 [5] =&gt; sha512
 [6] =&gt; ripemd128
 [7] =&gt; ripemd160
 [8] =&gt; whirlpool
 [9] =&gt; tiger128,3
 [10] =&gt; tiger160,3
 [11] =&gt; tiger192,3
 [12] =&gt; tiger128,4
 [13] =&gt; tiger160,4
 [14] =&gt; tiger192,4
 [15] =&gt; snefru
 [16] =&gt; gost
 [17] =&gt; adler32
 [18] =&gt; crc32
 [19] =&gt; crc32b
 [20] =&gt; haval128,3
 [21] =&gt; haval160,3
 [22] =&gt; haval192,3
 [23] =&gt; haval224,3
 [24] =&gt; haval256,3
 [25] =&gt; haval128,4
 [26] =&gt; haval160,4
 [27] =&gt; haval192,4
 [28] =&gt; haval224,4
 [29] =&gt; haval256,4
 [30] =&gt; haval128,5
 [31] =&gt; haval160,5
 [32] =&gt; haval192,5
 [33] =&gt; haval224,5
 [34] =&gt; haval256,5
 )</pre>
<p>You could calculate the hash of a string using the function hash(). Example:</p>
<pre class="brush: php;">
$hashed_string = hash('md5', 'apple');
// Value is '1f3870be274f6c49b3e31a0c6728957f'

$hashed_string = hash('adler32', 'banana');
// Value is '62024f08'</pre>
<p> <img src='http://www.codingcereal.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Thanks for reading!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingcereal.com/2010/06/php-hash-algorithms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Developers Summit 2010</title>
		<link>http://www.codingcereal.com/2010/01/php-developers-summit-2010/</link>
		<comments>http://www.codingcereal.com/2010/01/php-developers-summit-2010/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 15:08:11 +0000</pubDate>
		<dc:creator>Jhoy Imperial</dc:creator>
				<category><![CDATA[Event]]></category>

		<guid isPermaLink="false">http://www.codingcereal.com/?p=229</guid>
		<description><![CDATA[An Invitation In partnership with Microsoft Philippines, PHP User Group Philippines presents PHP Developers Summit 2010. We are inviting you <a href="http://www.codingcereal.com/2010/01/php-developers-summit-2010/">[...]</a>]]></description>
			<content:encoded><![CDATA[<h3>An Invitation</h3>
<p>In partnership with Microsoft Philippines, PHP User Group Philippines presents PHP Developers Summit 2010. We are inviting you to come and join us in this gathering of the country&#8217;s best tech-talents, professionals and web developers promoting the use of PHP and open source solutions in the enterprise and schools. Free flowing coffee with lots of freebies and raffle prizes plus new friends to meet! So what are you waiting for? Register now. See you all there! =)</p>
<h3>Be there&#8230;</h3>
<p><strong>Date:</strong> January 30, 2010, Saturday<br />
<strong>Time:</strong> 8:00 AM &#8211; 5:00 PM<br />
<strong>Venue:</strong> The Grand Ballroom, Hotel Rembrandt<br />
26 Tomas Morato Extension, Quezon City, Philippines</p>
<h3>Admission Fees</h3>
<p><strong>Early Bird Promo</strong> &#8211; Php 1,000.00 (until December 31, 2009 only)<br />
<strong>Regular</strong> &#8211; Php 1,200.00<br />
<strong>Walk-in</strong> &#8211; Php 1,500.00</p>
<p><em>Inclusive of</em></p>
<ul type="square">
<li>Meals (Lunch + Snacks)</li>
<li>Conference Kit</li>
<li>Event Shirt</li>
<li>Raffle Entry</li>
<li>Other Freebies</li>
</ul>
<p><img class="aligncenter" title="Trio Promo" src="http://conference.phpugph.com/images/trio_promo.png" alt="" width="429" height="129" style="border:none;" /></p>
<p>For more details, please visit the official website at <a href="http://conference.phpugph.com/">http://conference.phpugph.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingcereal.com/2010/01/php-developers-summit-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Star Rating + AJAX + PHP</title>
		<link>http://www.codingcereal.com/2009/11/jquery-star-rating-ajax-php/</link>
		<comments>http://www.codingcereal.com/2009/11/jquery-star-rating-ajax-php/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 18:47:48 +0000</pubDate>
		<dc:creator>Jhoy Imperial</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[AJAX star rating]]></category>
		<category><![CDATA[jQuery star rating]]></category>
		<category><![CDATA[PHP star rating]]></category>
		<category><![CDATA[star rating]]></category>

		<guid isPermaLink="false">http://www.codingcereal.com/?p=209</guid>
		<description><![CDATA[This article will show you how to create a simple star rating functionality using jQuery. All values will be stored <a href="http://www.codingcereal.com/2009/11/jquery-star-rating-ajax-php/">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>This article will show you how to create a simple star rating functionality using jQuery.</p>
<p>All values will be stored in our $_SESSION variables. I have set the limit of number of votes to 20. In our demo, when you have reached the total number votes, just clear your cookies in order to use the demo again.</p>
<p><span id="more-209"></span>Here is the <a href="http://www.codingcereal.com/demo/index.php?m=jquery-star-rating">Demo: jQuery Star Rating</a></p>
<h3>HTML head</h3>
<p>In our<em> &lt;head&gt;</em> part, we will include our jQuery file.</p>
<pre class="brush: jscript; light: true;">
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
</pre>
<h3>HTML body</h3>
<p>Our html body will display the average of votes, total number of votes, the 5 stars used in rating and a response text.</p>
<p>Line 3: &#8220;<em>#star-avg</em>&#8221; will hold the average of all the votes<br />
Line 4: &#8220;<em>#star-total</em>&#8221; will hold the total number of votes sent<br />
Line 7-21: These are the rating stars assigned with different IDs. By default, their class is set to display grey stars.<br />
Line 23: &#8220;<em>#star-msg</em>&#8221; will hold the response text from our remote file</p>
<pre class="brush: xml;">
        &lt;div class=&quot;star-rating-wrap&quot;&gt;
            &lt;p&gt;
                Average: &lt;span id=&quot;star-avg&quot;&gt;0&lt;/span&gt;,
                Total Ratings: &lt;span id=&quot;star-total&quot;&gt;0&lt;/span&gt;
            &lt;/p&gt;
            &lt;div class=&quot;star-rating&quot;&gt;
                &lt;a href=&quot;#&quot;&gt;
                    &lt;span id=&quot;star1&quot; class=&quot;star-grey&quot; title=&quot;1&quot;&gt;&amp;nbsp;&lt;/span&gt;
                &lt;/a&gt;
                &lt;a href=&quot;#&quot; &gt;
                    &lt;span id=&quot;star2&quot; class=&quot;star-grey&quot; title=&quot;2&quot;&gt;&amp;nbsp;&lt;/span&gt;
                &lt;/a&gt;
                &lt;a href=&quot;#&quot; &gt;
                    &lt;span id=&quot;star3&quot; class=&quot;star-grey&quot; title=&quot;3&quot;&gt;&amp;nbsp;&lt;/span&gt;
                &lt;/a&gt;
                &lt;a href=&quot;#&quot; &gt;
                    &lt;span id=&quot;star4&quot; class=&quot;star-grey&quot; title=&quot;4&quot;&gt;&amp;nbsp;&lt;/span&gt;
                &lt;/a&gt;
                &lt;a href=&quot;#&quot; &gt;
                    &lt;span id=&quot;star5&quot; class=&quot;star-grey&quot; title=&quot;5&quot;&gt;&amp;nbsp;&lt;/span&gt;
                &lt;/a&gt;
            &lt;/div&gt;
            &lt;p id=&quot;star-msg&quot;&gt;&amp;nbsp;&lt;/p&gt;
        &lt;/div&gt;
</pre>
<h3>jQuery Script</h3>
<p>This is our jQuery script and should be place within the <em>&lt;body&gt;</em> tag.</p>
<p>Line 3: &#8220;<em>default_star_value</em>&#8221; will hold the average value of votes<br />
Line 5: We need to catch the mouse over event. On mouse over, we need to get the value of the star that is placed inside the title attribute of the span and pass it the <em>showRedStar()</em> function.<br />
Line 7: On mouse out, we will call the <em>hideRedStar()</em> function to hide the red stars<br />
Line 9: When user click a star, this should be counted as a vote.<br />
Line 10: Clear the response text area<br />
Line 12: Get the value of selected star<br />
Line 14: We will send an AJAX request to our remote file<br />
Line 15: Remote file<br />
Line 17: This would be our submitted value<br />
Line 18-20: Display the response text<br />
Line 22: Update the <em>default_star_value</em> with the latest average total<br />
Line 26: Set response type as JSON<br />
Line 30: On mouse out of our rating stars, highlight the average star votes<br />
Line 35: <em>showRedStar()</em> function highlights the stars in red<br />
Line 43: <em>hideRedStar()</em> function removeds the red stars</p>
<pre class="brush: jscript;">
        &lt;script type=&quot;text/javascript&quot;&gt;
            $(document).ready(function(){
                var default_star_value = 0;

                $(&quot;a span&quot;).mouseover(function(){
                    showRedStar($(this).attr('title'))
                }).mouseout(function(){
                    hideRedStar()
                }).click(function(){
                    $(&quot;#star-msg&quot;).html(&quot;&quot;);

                    var selected_star = $(this).attr('title');

                    $.post(
                        &quot;demo/jquery-star-rating-response.php&quot;,
                        { star: selected_star },
                        function(data){
                            $(&quot;#star-avg&quot;).html(data.average);
                            $(&quot;#star-total&quot;).html(data.total);
                            $(&quot;#star-msg&quot;).html(data.message);

                            default_star_value = data.average

                            showRedStar(default_star_value)
                        },
                        &quot;json&quot;
                    );
                });

                $(&quot;a&quot;).mouseout(function(){
                    showRedStar(default_star_value)
                });
            });

            function showRedStar(star_number){
                hideRedStar();

                for(star_ctr = 1; star_ctr &lt;= star_number; star_ctr++){
                    $(&quot;#star&quot; + star_ctr).removeClass('star-grey').addClass('star-red');
                }
            }

            function hideRedStar(){
                for(star_ctr = 5; star_ctr &gt;=1; star_ctr--){
                    $(&quot;#star&quot; + star_ctr).removeClass('star-red').addClass('star-grey');
                }
            }
        &lt;/script&gt;
</pre>
<h3>PHP</h3>
<p>In our remote file, we will process the vote using PHP. For this demo, instead of saving the votes in a database, we will store our values in a $_SESSION array.</p>
<p>Line 01: start our session<br />
Line 03: Store the list of valid star vote values in an array<br />
Line 05: Set the default total number of votes to &#8220;<em>0</em>&#8221;<br />
Line 06: Set the default average to &#8220;0&#8243;<br />
Line 08: Check if we have reached the total limit of 20 votes<br />
Line 09: If limit is not yet reached, check if the submitted value is in our list<br />
Line 10: If valid value is submitted, push our submitted value to our array holder of votes<br />
Line 11: Set message that the vote has been counted<br />
Line 14: If the submitted value is not valid, set message that it is invalid<br />
Line 18: If the limit has been reached, set message that says we have reached the total limit of votes<br />
Line 21: Check if we stored votes in our session<br />
Line 22: If there our votes stored, get the average of our votes. We use the <em>ceil()</em> function to round of the average to the nearest ones. So, if the average is <em>4.98</em>, the returned value would be <em>5</em><br />
Line 23: Count the total number of votes<br />
Line 26: Display our result in JSON format</p>
<pre class="brush: php;">
    session_start();

    $starValuesArr = array(1, 2, 3, 4, 5);

    $responseArr['total'] = 0;
    $responseArr['average'] = 0;

    if (count($_SESSION['rating']) &lt; 20){
        if (in_array($_POST['star'], $starValuesArr)){
            $_SESSION['rating'][] = $_POST['star'];
            $responseArr['message'] = 'Thank you for the rating!';
        }
        else{
            $responseArr['message'] = 'Invalid vote value';
        }
    }
    else{
        $responseArr['message'] = 'You have reached the limit of 20 votes. &lt;br/&gt;Try to clearing your cookies to be able to vote again.';
    }

    if (count($_SESSION['rating']) &gt; 0){
        $responseArr['average'] = ceil(array_sum($_SESSION['rating']) / count($_SESSION['rating']));
        $responseArr['total'] = count($_SESSION['rating']);
    }

    echo json_encode($responseArr)
</pre>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 190px; width: 1px; height: 1px;">Line 3: &#8220;#star-avg&#8221; will hold the average of all the votes<br />
Line 4: &#8220;#star-total&#8221; will hold the total number of votes sent<br />
Line 7-21: These are the rating stars assigned with different IDs. By default, their class is set to display grey stars.<br />
Line 23: &#8220;#star-msg&#8221; will hold the response text from our remote file</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codingcereal.com/2009/11/jquery-star-rating-ajax-php/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Autopopulate Select Dropdown Box Using jQuery</title>
		<link>http://www.codingcereal.com/2009/09/autopopulate-select-dropdown-box-using-jquery/</link>
		<comments>http://www.codingcereal.com/2009/09/autopopulate-select-dropdown-box-using-jquery/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 21:46:58 +0000</pubDate>
		<dc:creator>Jhoy Imperial</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[dynamic dropdown box]]></category>
		<category><![CDATA[dynamic select box]]></category>
		<category><![CDATA[jQuery autopopulate dropdown]]></category>
		<category><![CDATA[jQuery autopopulate select]]></category>
		<category><![CDATA[jQuery dynamic dropdown]]></category>
		<category><![CDATA[jquery dynamic select]]></category>

		<guid isPermaLink="false">http://www.codingcereal.com/?p=183</guid>
		<description><![CDATA[In this tutorial, we will dynamically populate a select dropdown box using jQuery. A sample usage of this is when <a href="http://www.codingcereal.com/2009/09/autopopulate-select-dropdown-box-using-jquery/">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial, we will dynamically populate a select dropdown box using jQuery.</p>
<p>A sample usage of this is when we have a list of countries and we want display its corresponding cities in another select box.</p>
<p><span id="more-183"></span>Here is the <a title="Demo: Autopopulate Select Dropdown Box Using jQuery" href="http://www.codingcereal.com/demo/index.php?m=jquery-autopopulate-select-dropdown-box" target="_blank">live DEMO of Autopopulate Select Dropdown Box Using jQuery</a>.</p>
<h3>HTML head</h3>
<p>Let us include our jquery file in our <em>&lt;head&gt;</em> area.</p>
<pre class="brush: plain;">
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
</pre>
<h3>HTML body</h3>
<p>We will be needing two dropdown select boxes. The first one(<em>#selection</em>) would contain the list of categories and the second(<em>#selectionlist</em>) would be the result list.</p>
<p>The <em>#result</em> paragraph would contain our notification message.</p>
<pre class="brush: xml;">
        &lt;p&gt;
            Select Dropdown
        &lt;/p&gt;
        &lt;p&gt;
            &lt;select id=&quot;selection&quot;&gt;
                &lt;option value=&quot;&quot;&gt;
                    - Select Item Here -
                &lt;/option&gt;
                &lt;option value=&quot;food&quot;&gt;
                    List of Food
                &lt;/option&gt;
                &lt;option value=&quot;animals&quot;&gt;
                    List of Animals
                &lt;/option&gt;
                &lt;option value=&quot;flowers&quot;&gt;
                    List of Flowers
                &lt;/option&gt;
            &lt;/select&gt;
        &lt;/p&gt;
        &lt;p&gt;
            DropDown Result
        &lt;/p&gt;
        &lt;p&gt;
            &lt;select id=&quot;selectionresult&quot;&gt;&lt;/select&gt;
        &lt;/p&gt;
        &lt;p id=&quot;result&quot;&gt;&amp;nbsp;&lt;/p&gt;
</pre>
<h3>jQuery Script</h3>
<p>On page load, we would hide our <em>#selectionresult</em> using the <em>hide()</em> jquery function.</p>
<p>Our AJAX request is triggered whenever we select a value in our dropdown box using the <em>change()</em> jquery function. When we send a request, we set our <em>#result</em> to &#8220;Retrieving &#8230;&#8221; to notify the user that we are already sending a request to our remote file.</p>
<p>Once we receive the response from our remote file, we will insert the response text <em>msg </em>in our <em>#selection</em> using<em> html()</em> jquery function. If the <em>msg </em>result is empty, we will simply display a notification message like &#8220;No item result&#8221;.</p>
<pre class="brush: plain;">
        &lt;script type=&quot;text/javascript&quot;&gt;
        $(document).ready(function(){
            $(&quot;#selectionresult&quot;).hide();

            $(&quot;#selection&quot;).change( function() {
                $(&quot;#selectionresult&quot;).hide();
                $(&quot;#result&quot;).html('Retrieving ...');
                $.ajax({
                    type: &quot;POST&quot;,
                    data: &quot;data=&quot; + $(this).val(),
                    url: &quot;demo/jquery-autopopulate-select-dropdown-box-response.php&quot;,
                    success: function(msg){
                        if (msg != ''){
                            $(&quot;#selectionresult&quot;).html(msg).show();
                            $(&quot;#result&quot;).html('');
                        }
                        else{
                            $(&quot;#result&quot;).html('&lt;em&gt;No item result&lt;/em&gt;');
                        }
                    }
                });
            });
        });
        &lt;/script&gt;
</pre>
<h3>PHP</h3>
<p>Here is the content of our remote file.</p>
<p>In <em>$expectedValues</em> we created an array list of our expected values, hence, if the posted value from our main page is not found in this array, we will return an empty message.</p>
<p>The <em>$selectionArr</em> contains the list of items for each data entry. We call the array index of our selected data. Once selected, using <em>foreach</em>, we will run a loop in the list of data under our selected array and echo each inside the <em>&lt;option&gt;</em> tag. In this way, our main page will be able to retrieve our data in HTML form and is ready to be inserted in our <em>&lt;select&gt;</em> tag.</p>
<pre class="brush: php;">
    $expectedValues = array(&quot;food&quot;, &quot;animals&quot;, &quot;flowers&quot;);

    $selectionArr['food'] = array('pizza', 'spaghetti', 'rice');
    $selectionArr['animals'] = array('cat', 'dog', 'girrafe', 'pig', 'chicken');
    $selectionArr['flowers'] = array('rose', 'sampaguita');

    if (isset($_POST['data']) and in_array($_POST['data'], $expectedValues)){
        $selectedArr = $selectionArr[$_POST['data']];

        foreach($selectedArr as $optionValue){
            echo '&lt;option&gt;' . $optionValue . '&lt;/option&gt;';
        }
    }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.codingcereal.com/2009/09/autopopulate-select-dropdown-box-using-jquery/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Retrieving Data Using AJAX + jQuery</title>
		<link>http://www.codingcereal.com/2009/09/retrieving-data-using-ajax-jquery/</link>
		<comments>http://www.codingcereal.com/2009/09/retrieving-data-using-ajax-jquery/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 21:15:18 +0000</pubDate>
		<dc:creator>Jhoy Imperial</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[AJAX form post]]></category>
		<category><![CDATA[jQuery AJAX]]></category>
		<category><![CDATA[jQuery post]]></category>
		<category><![CDATA[jquery post example]]></category>
		<category><![CDATA[jquery post form]]></category>
		<category><![CDATA[jquery tutorial]]></category>

		<guid isPermaLink="false">http://www.codingcereal.com/?p=163</guid>
		<description><![CDATA[In this article, I will demonstrate to you a simple code to retrieve post and receive data using AJAX in <a href="http://www.codingcereal.com/2009/09/retrieving-data-using-ajax-jquery/">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>In this article, I will demonstrate to you a simple code to retrieve post and receive data using AJAX in jQuery.</p>
<h3>What does this sample do?</h3>
<p>We would send a sample text via $_POST to our remote response file. Our remote url file would then generate a table with a random number of rows and use the sample text that we sent as filler text. We will not be using any &lt;form&gt; element for this sample.</p>
<p><span id="more-163"></span>Here is the live demo of <a href="http://www.codingcereal.com/demo/index.php?m=jquery-ajax-post" target="_blank">Retrieving Data Using AJAX + jQuery</a>.</p>
<h3>HTML head</h3>
<p>In the &lt;head&gt; area, let&#8217;s include our jQuery framework.</p>
<pre>&lt;script type="text/javascript" src="jquery-1.3.2.min.js"&gt;&lt;/script&gt;</pre>
<h3>CSS</h3>
<p>Next, we add little styling for our table.</p>
<pre>div#content{
	border:solid 1px #000000;
	margin:5px;
	padding:5px;
	width:600px;
}
div#content table{
	font-family:sans-serif;
	font-size:0.9em;
	border-collapse:collapse;
}
div#content table thead{
	font-weight:bold;
	background-color:#DFDFDF;
}
div#content table tbody tr{
	border-bottom: solid 1px #DFDFDF;
}
.td-col1{ width: 50px;}
.td-col2{ width: 150px;}
.td-col3{ width: 150px;}
.td-col4{ width: 150px;}</pre>
<h3>HTML body</h3>
<p>Our body contains an input field where we would enter the sample text that we want, a button that would trigger the click event and send the value to our remote file and a &lt;div&gt; where the response text will be placed.</p>
<pre>&lt;p&gt;
	Enter sample data here
	&lt;input id="data" type="text" value="Lorem Ipsum" /&gt;
	&lt;input type="button" href="#get-content" id="clickme"
	value="Get Remote Table Data" /&gt;
&lt;/p&gt;
&lt;div id="content"&gt;
	The table will be placed here
&lt;/div&gt;</pre>
<h3>jQuery Script</h3>
<p>Using the click event as a trigger, we will be able to send a $_POST value to our remote file.</p>
<p>Get the value of our textfield with &#8220;data&#8221; as an id</p>
<pre>$("#data").val()</pre>
<p>Set the $_POST['data'] with the input text value</p>
<pre>data: "data=" + $("#data").val()</pre>
<pre>success: function(msg){
	$("#content").html(msg)
}</pre>
<p>After a successfully request, the response text will be received using &#8220;msg&#8221; which we will display in our</p>
<pre>&lt;div id="content"&gt;
	The table will be placed here
&lt;/div&gt;</pre>
<p>Here is the complete script code</p>
<pre>&lt;script type="text/javascript"&gt;
	$(document).ready(function(){
		$("#clickme").click(function () {
			$("#content").html('Retrieving...');
			$.ajax({
				type: "POST",
				data: "data=" + $("#data").val(),
				url: "demo/jquery-ajax-post-response.php",
				success: function(msg){
					$("#content").html(msg)
				}
			});
		});
	});
&lt;/script&gt;</pre>
<h3>PHP</h3>
<p>Here is content of our remote file</p>
<pre>&lt;?php
	$sampleData = 'la la la';
	if (isset($_POST['data']) and trim($_POST['data']) != '' ) {
		$sampleData = trim($_POST['data']);
	}
	$rowCount = rand(1, 10);
?&gt;
&lt;p&gt;
	Total data rows : &lt;?php echo $rowCount; ?&gt;&lt;br /&gt;
	Sample data : &lt;?php echo $sampleData; ?&gt;&lt;br /&gt;
	Request time :
	&lt;?php echo date('F d, Y h:i:s a', $_SERVER['REQUEST_TIME']); ?&gt;
&lt;/p&gt;
&lt;table&gt;
	&lt;thead&gt;
	&lt;tr&gt;
		&lt;td class="td-col1"&gt;#&lt;/td&gt;
		&lt;td class="td-col2"&gt;Column 1&lt;/td&gt;
		&lt;td class="td-col3"&gt;Column 2&lt;/td&gt;
		&lt;td class="td-col4"&gt;Column 3&lt;/td&gt;
	&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
	&lt;?php for($rowCtr = 1; $rowCtr &lt;= $rowCount; $rowCtr++): ?&gt;
	&lt;tr&gt;
		&lt;td&gt;&lt;?php echo $rowCtr; ?&gt;&lt;/td&gt;
		&lt;td&gt;&lt;?php echo $sampleData; ?&gt;&lt;/td&gt;
		&lt;td&gt;&lt;?php echo $sampleData; ?&gt;&lt;/td&gt;
		&lt;td&gt;&lt;?php echo $sampleData; ?&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;?php endfor; ?&gt;
	&lt;/tbody&gt;
&lt;/table&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.codingcereal.com/2009/09/retrieving-data-using-ajax-jquery/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Design Wars: ilovecolors vs tsoknat</title>
		<link>http://www.codingcereal.com/2009/08/design-wars-ilovecolors-vs-tsoknat/</link>
		<comments>http://www.codingcereal.com/2009/08/design-wars-ilovecolors-vs-tsoknat/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 21:28:39 +0000</pubDate>
		<dc:creator>CodingCereal</dc:creator>
				<category><![CDATA[Design Wars]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.codingcereal.com/?p=142</guid>
		<description><![CDATA[Starting today, we decided to have a weekly article in our blog titled the &#8220;Design Wars&#8221;. The aim is for <a href="http://www.codingcereal.com/2009/08/design-wars-ilovecolors-vs-tsoknat/">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Starting today, we decided to have a weekly article in our blog titled the &#8220;Design Wars&#8221;. The aim is for the authors to pick the best designed site that they found in the cyberworld every week, do a poll and let the readers decide which one is the best. Sadly, we can&#8217;t offer any price for this. Well, maybe in the future <img src='http://www.codingcereal.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> <span id="more-142"></span></p>
<p>And so, for our very first round, here are what the authors picked as the best designed site for this week.</p>
<p style="text-align: center;"><a href="http://www.ilovecolors.com.ar"><img class="alignnone size-full wp-image-143" title="www.ilovecolors.com.ar" src="http://www.codingcereal.com/wp-content/uploads/2009/08/ilovecolors.jpg" alt="www.ilovecolors.com.ar" width="360" height="428" /></a></p>
<p style="text-align: center;"><a href="http://www.ilovecolors.com.ar/">www.ilovecolors.com.ar</a><br />
<em>picked by Jhoy Imperial</em></p>
<p style="text-align: center;"><a href="http://www.tsoknat.com"><img class="alignnone size-full wp-image-144" title="www.tsoknat.com" src="http://www.codingcereal.com/wp-content/uploads/2009/08/tsoknat.jpg" alt="www.tsoknat.com" width="360" height="428" /></a></p>
<p style="text-align: center;"><a href="http://www.tsoknat.com">www.tsoknat.com</a><br />
<em>picked by Romeo John Pasion</em></p>
<p>You could cast  your vote using the poll found at the sidebar &#8211;&gt;</p>
<p>Next week, we will officially announce which site won. hooray! <img src='http://www.codingcereal.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Feel free to add your comments and suggestion.</p>
<p>Happy voting <img src='http://www.codingcereal.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingcereal.com/2009/08/design-wars-ilovecolors-vs-tsoknat/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Customizing Tooltips Using jQuery</title>
		<link>http://www.codingcereal.com/2009/08/custom-tooltips-using-jquery/</link>
		<comments>http://www.codingcereal.com/2009/08/custom-tooltips-using-jquery/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 13:28:38 +0000</pubDate>
		<dc:creator>Jhoy Imperial</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[custom tooltips]]></category>
		<category><![CDATA[jquery snippet]]></category>
		<category><![CDATA[jquery tooltips]]></category>
		<category><![CDATA[simple tooltips]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.codingcereal.com/?p=128</guid>
		<description><![CDATA[Here is a simple code on  how you could customize your tooltips using jQuery. The idea here is to use <a href="http://www.codingcereal.com/2009/08/custom-tooltips-using-jquery/">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Here is a simple code on  how you could customize your tooltips using jQuery.</p>
<p>The idea here is to use the <em>&lt;label&gt;</em> tag as the custom tooltip for our links. The id of our <em>&lt;a&gt;</em> is the same value as the <em>&#8220;for&#8221;</em> attribute of the <em>&lt;label&gt;</em> tag. In this way, we have created a relationship between the<em> &lt;a&gt;</em> tag and <em>&lt;label&gt;</em> tag.</p>
<p><span id="more-128"></span>Here is the <a href="http://www.codingcereal.com/demo/index.php?m=simpletooltip" target="_blank">Live Demo</a> of this script.</p>
<p>The script supports:</p>
<ul>
<li>Plain text tooltips</li>
<li>HTML Formatted text</li>
<li>Tooltips with images</li>
</ul>
<h3>HTML head</h3>
<p>First, we must include the latest jQuery inside our &lt;head&gt;&lt;/head&gt; tags.</p>
<pre>&lt;script type="text/javascript" src="jquery-1.3.2.min.js"&gt;&lt;/script&gt;</pre>
<h3>CSS</h3>
<p>Then, let us add some styling to our tooltips.</p>
<pre>.tooltip label{
    margin-left:10px;
    display:none;
    border:solid 1px #7DA7D9;
    padding:5px;
    background-color:#ffffff;
    position:absolute;
}</pre>
<h3>HTML body</h3>
<p>Next, i would be using &lt;ul&gt; as the container for our links.</p>
<pre>&lt;ul class="tooltip"&gt;
&lt;li&gt;
    &lt;a href="#link1" id="link1"&gt;Link 1&lt;/a&gt;
    &lt;label for="link1"&gt;This is the tooltip for "Link 1"&lt;/label&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a href="#link2" id="link2"&gt;Formatted Tooltip&lt;/a&gt;
    &lt;label for="link2"&gt;
        &lt;em&gt;This&lt;/em&gt; is a &lt;br /&gt;&lt;strong&gt;formatted&lt;/strong&gt;
&lt;span style="color:red;"&gt;tooltip&lt;/span&gt;
    &lt;/label&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a href="#link3" id="link3"&gt;Image in tooltip&lt;/a&gt;
    &lt;label for="link3"&gt;
        &lt;img src="yahoo-screenshot.jpg" /&gt;
    &lt;/label&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a href="#link4" id="link4"&gt;Image in tooltip 2&lt;/a&gt;
    &lt;label for="link4"&gt;
        &lt;img src="sample-image.jpg" /&gt;
        &lt;br /&gt;
        Another tooltip with image
    &lt;/label&gt;
&lt;/li&gt;
&lt;/ul&gt;</pre>
<h3>jQuery Script</h3>
<p>Finally, we add our jQuery script. Whenever a user hovers his mouse over link, the script would use the link id to search for label that is related to our link using the for attribute in the <em>&lt;label&gt;</em> tag. I used the <em>show()</em> function to make the label visible when hovering and the <em>hide()</em> function to hide it.</p>
<pre>script type="text/javascript"&gt;
    $(".tooltip a").mouseover(function(){
        $('label[for="' + $(this).attr("id") + '"]').show();
    }).mouseout(function(){
        $('label[for="' + $(this).attr("id") + '"]').hide();
    });
&lt;/script&gt;</pre>
<p><script type="text/javascript">// <![CDATA[
            $(".tooltip a").mouseover(function(){
                $('label[for="' + $(this).attr("id") + '"]').show();
            }).mouseout(function(){
                $('label[for="' + $(this).attr("id") + '"]').hide();
            });
// ]]&gt;</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingcereal.com/2009/08/custom-tooltips-using-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Free Template: Baby Template</title>
		<link>http://www.codingcereal.com/2009/08/free-template-baby-template/</link>
		<comments>http://www.codingcereal.com/2009/08/free-template-baby-template/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 09:05:11 +0000</pubDate>
		<dc:creator>Romeo John Pasion</dc:creator>
				<category><![CDATA[Downloadables]]></category>
		<category><![CDATA[Flash Template]]></category>
		<category><![CDATA[Web Template]]></category>
		<category><![CDATA[baby blog]]></category>
		<category><![CDATA[baby blog template]]></category>
		<category><![CDATA[baby template]]></category>
		<category><![CDATA[downloadable template]]></category>
		<category><![CDATA[flash header]]></category>
		<category><![CDATA[free downloadable template]]></category>
		<category><![CDATA[free template]]></category>
		<category><![CDATA[free web template]]></category>
		<category><![CDATA[Two Column Template]]></category>

		<guid isPermaLink="false">http://www.codingcereal.com/?p=120</guid>
		<description><![CDATA[View the Live DEMO of Baby template You can download this free template at Baby Template.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="alignnone" title="Baby Template Screenshot" src="http://www.codingcereal.com/file/babytemplate/screenshot.png" alt="Screenshot: Baby Template" width="360" height="414" /></p>
<p style="text-align: left;">View the <a href="http://www.codingmind.com/templates/baby" target="_blank">Live DEMO of Baby template</a></p>
<p style="text-align: left;">You can download this free template at <a href="http://www.codingcereal.com/file/babytemplate/babytemplate.zip">Baby Template</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingcereal.com/2009/08/free-template-baby-template/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
