<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>PHP Scripts - WordPress Tutorials</title>
	
	<link>http://www.computersneaker.com</link>
	<description>PHP Scripts - WordPress Tutorials</description>
	<lastBuildDate>Mon, 17 Jun 2013 13:50:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/computersneaker" /><feedburner:info uri="computersneaker" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>computersneaker</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Posting form data using Ajax in CodeIgniter</title>
		<link>http://feedproxy.google.com/~r/computersneaker/~3/GsRcPi9HaIQ/</link>
		<comments>http://www.computersneaker.com/posting-form-data-using-ajax-in-codeigniter/#comments</comments>
		<pubDate>Mon, 17 Jun 2013 13:47:26 +0000</pubDate>
		<dc:creator>Mudasir Nazir</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.computersneaker.com/?p=704</guid>
		<description><![CDATA[<p><p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p>Using Ajax to submit form data has become one of the important and modern way of development. In this tutorial you will learn how to send form data using Ajax and Code Igniter (MVC Framework) I want you to know that this tutorial for beginners only now for experts. You need to follow few steps [...]</p></p><p><a href="http://www.computersneaker.com/posting-form-data-using-ajax-in-codeigniter/">Posting form data using Ajax in CodeIgniter</a></p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->Using Ajax to submit form data has become one of the important and modern way of development. In this tutorial you will learn how to send form data using Ajax and Code Igniter (MVC Framework)</p>
<p>I want you to know that this tutorial for beginners only now for experts. You need to follow few steps to post form values.</p>
<p style="text-align: center;"><a href="http://www.computersneaker.com/wp-content/uploads/2013/06/posting-form-data-in-ajax-and-codeigniter.jpg"><img class="aligncenter  wp-image-713" style="border: 2px solid black;" alt="posting-form-data-in-ajax-and-codeigniter" src="http://www.computersneaker.com/wp-content/uploads/2013/06/posting-form-data-in-ajax-and-codeigniter.jpg" width="500" height="150" /></a></p>
<p>1-      You need to <a href="http://jquery.com/download/">download JQuery</a> from JQuery Website.</p>
<p>2-      Include your JQuery file in header of your View File.</p>
<div id="fvch-codeblock-0" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-line-numbers">
<pre>1
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-0"><span class="js"><span class="js-operator">&lt;</span>script src<span class="js-operator">=</span>”Your_Project<span class="js-operator">/</span>JSDirectory<span class="js-operator">/</span>jquery<span class="js-operator">-</span><span class="js-number">1</span>.<span class="js-number">1</span><span class="js-number">0</span>.<span class="js-number">1</span>.<span class="js-native-keyword">min</span>.js”<span class="js-operator">&gt;</span><span class="js-operator">&lt;</span><span class="js-operator">/</span>script<span class="js-operator">&gt;</span></span></pre>
</td>
</tr>
</table>
</div>
<p>3-      Now paste following code anywhere in your HTML code.</p>
<div id="fvch-codeblock-1" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-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
23
24
25
26
27
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-1"><span class="js">$<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span><span class="js-bracket">{</span>

$<span class="js-bracket">(</span><span class="js-string">&quot;#add_user&quot;</span><span class="js-bracket">)</span>.<span class="js-client-keyword">submit</span><span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span><span class="js-bracket">{</span>

dataString <span class="js-operator">=</span> $<span class="js-bracket">(</span><span class="js-string">&quot;#add_user&quot;</span><span class="js-bracket">)</span>.serialize<span class="js-bracket">(</span><span class="js-bracket">)</span>;

$.ajax<span class="js-bracket">(</span><span class="js-bracket">{</span>

type<span class="js-operator">:</span> <span class="js-string">&quot;POST&quot;</span>,

url<span class="js-operator">:</span> <span class="js-string">&quot;&lt;?php echo base_url(); ?&gt;users/Add_User&quot;</span>,

data<span class="js-operator">:</span> dataString,

success<span class="js-operator">:</span> <span class="js-function-keyword">function</span><span class="js-bracket">(</span>data<span class="js-bracket">)</span><span class="js-bracket">{</span>

<span class="js-client-keyword">alert</span><span class="js-bracket">(</span><span class="js-string">'Successful!'</span><span class="js-bracket">)</span>;

<span class="js-bracket">}</span>

<span class="js-bracket">}</span><span class="js-bracket">)</span>;

<span class="js-reserved-keyword">return</span> <span class="js-reserved-keyword">false</span>;  <span class="js-comment">//stop the actual form post</span>

<span class="js-bracket">}</span><span class="js-bracket">)</span>;

<span class="js-bracket">}</span><span class="js-bracket">)</span>;</span></pre>
</td>
</tr>
</table>
</div>
<p>4-      Here is the form code that will send values:</p>
<div id="fvch-codeblock-2" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-line-numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-2"><span class="html"><span class="html-form-element">&lt;form id=<span class="html-attribute">&quot;add_user&quot;</span> method=<span class="html-attribute">&quot;post&quot;</span> enctype=<span class="html-attribute">&quot;multipart/form-data&quot;</span>&gt;</span>

<span class="html-other-element">&lt;label&gt;</span>Name: <span class="html-other-element">&lt;/label&gt;</span>

<span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;text&quot;</span> name=<span class="html-attribute">&quot;name&quot;</span> /&gt;</span>

<span class="html-other-element">&lt;br /&gt;</span>

<span class="html-other-element">&lt;label&gt;</span>Comment: <span class="html-other-element">&lt;/label&gt;</span>

<span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;password&quot;</span> name=<span class="html-attribute">&quot;password&quot;</span> /&gt;</span>

<span class="html-other-element">&lt;br /&gt;</span>

<span class="html-other-element">&lt;label&gt;</span><span class="html-special-char">&amp;nbsp;</span><span class="html-other-element">&lt;/label&gt;</span>

<span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;submit&quot;</span> value=<span class="html-attribute">&quot;Submit&quot;</span> /&gt;</span>

<span class="html-form-element">&lt;/form&gt;</span></span></pre>
</td>
</tr>
</table>
</div>
<p>5-      Now create a Controller that will action with the passed values.</p>
<div id="fvch-codeblock-3" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-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
23
24
25
26
27
28
29
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-3"><span class="php"><span class="php-script-tag">&lt;?php</span> <span class="php-keyword">if</span> <span class="php-brackets">(</span> <span class="php-operator">!</span> <span class="php-function">defined</span><span class="php-brackets">(</span><span class="php-string">'BASEPATH'</span><span class="php-brackets">)</span><span class="php-brackets">)</span> <span class="php-function">exit</span><span class="php-brackets">(</span><span class="php-string">'No direct script access allowed'</span><span class="php-brackets">)</span>;

<span class="php-keyword">class</span> Users <span class="php-keyword">extends</span> CI_Controller <span class="php-brackets">{</span>

<span class="php-function">function</span> __construct<span class="php-brackets">(</span><span class="php-brackets">)</span>

<span class="php-brackets">{</span>

parent<span class="php-operator">:</span><span class="php-operator">:</span>__construct<span class="php-brackets">(</span><span class="php-brackets">)</span>;

<span class="php-brackets">}</span>

<span class="php-function">function</span> Add_User<span class="php-brackets">(</span><span class="php-brackets">)</span>

<span class="php-brackets">{</span>

<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$_POST</span><span class="php-brackets">)</span>

<span class="php-brackets">{</span>

<span class="php-comment">//Operate your POST values</span>

<span class="php-brackets">}</span>

<span class="php-brackets">}</span>

<span class="php-brackets">}</span>

<span class="php-script-tag">?&gt;<span class="html"></span></span></span></pre>
</td>
</tr>
</table>
</div>
<p>This is all hope you will like this, and if you like this, don’t forget to comment and subscribe
<div class="shr-publisher-704"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
<p><a href="http://www.computersneaker.com/posting-form-data-using-ajax-in-codeigniter/">Posting form data using Ajax in CodeIgniter</a></p><img src="http://feeds.feedburner.com/~r/computersneaker/~4/GsRcPi9HaIQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.computersneaker.com/posting-form-data-using-ajax-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.computersneaker.com/posting-form-data-using-ajax-in-codeigniter/</feedburner:origLink></item>
		<item>
		<title>DZone Goody Package Arrives</title>
		<link>http://feedproxy.google.com/~r/computersneaker/~3/Tm8JmlpObcU/</link>
		<comments>http://www.computersneaker.com/dzone-goody-package-arrives/#comments</comments>
		<pubDate>Wed, 12 Jun 2013 20:53:22 +0000</pubDate>
		<dc:creator>Mudasir Nazir</dc:creator>
				<category><![CDATA[Blogging]]></category>

		<guid isPermaLink="false">http://www.computersneaker.com/?p=698</guid>
		<description><![CDATA[<p><p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p>I am DZone Contributor from last year and it made me happy that all my struggle bring me something. This is appreciation from DZone. Today when i get back from my office, i just found DZone Goody Package waiting for me at my home. DZone sent me T-Shirt, A USB stick from Tizen, a discount [...]</p></p><p><a href="http://www.computersneaker.com/dzone-goody-package-arrives/">DZone Goody Package Arrives</a></p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->I am <a href="http://www.dzone.com/">DZone </a>Contributor from last year and it made me happy that all my struggle bring me something. This is appreciation from <a href="http://www.dzone.com/">DZone</a>. Today when i get back from my office, i just found <a href="http://www.dzone.com/">DZone </a>Goody Package waiting for me at my home. <a href="http://www.dzone.com/">DZone </a>sent me T-Shirt, A USB stick from <a href="https://www.tizen.org/">Tizen</a>, a discount card from <a href="http://www.manning.com/">Minning Publications</a> and many other things. I even got my own chance to get an iPad from <a href="http://www.dzone.com/">DZone</a>.</p>
<p style="text-align: center;"><a href="http://www.computersneaker.com/wp-content/uploads/2013/06/2013-06-12-991.jpg"><img class="aligncenter  wp-image-699" style="border: 2px solid black;" alt="Dzone Goodies" src="http://www.computersneaker.com/wp-content/uploads/2013/06/2013-06-12-991.jpg" width="600" height="400" /></a></p>
<div class="shr-publisher-698"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
<p><a href="http://www.computersneaker.com/dzone-goody-package-arrives/">DZone Goody Package Arrives</a></p><img src="http://feeds.feedburner.com/~r/computersneaker/~4/Tm8JmlpObcU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.computersneaker.com/dzone-goody-package-arrives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.computersneaker.com/dzone-goody-package-arrives/</feedburner:origLink></item>
		<item>
		<title>Send Email Using PHPMailer and Codeigniter</title>
		<link>http://feedproxy.google.com/~r/computersneaker/~3/W5MEnGt9W9M/</link>
		<comments>http://www.computersneaker.com/send-email-using-phpmailer-and-codeigniter/#comments</comments>
		<pubDate>Mon, 10 Jun 2013 17:12:27 +0000</pubDate>
		<dc:creator>Mudasir Nazir</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.computersneaker.com/?p=688</guid>
		<description><![CDATA[<p><p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p>CodeIgniter Email Class built for handling double-byte characters is really bad, cannot be properly set up Charest UTF-8. Here I want to share my information to use Codeigniter and PHPmailer together. In this way you can send any type of codes in Email Body.  We have to follow few steps to use PHPmailer with CodeIgniter. [...]</p></p><p><a href="http://www.computersneaker.com/send-email-using-phpmailer-and-codeigniter/">Send Email Using PHPMailer and Codeigniter</a></p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->CodeIgniter Email Class built for handling double-byte characters is really bad, cannot be properly set up Charest UTF-8.</p>
<p>Here I want to share my information to use Codeigniter and PHPmailer together. In this way you can send any type of codes in Email Body.  We have to follow few steps to use PHPmailer with CodeIgniter.</p>
<p><a href="http://www.computersneaker.com/wp-content/uploads/2013/06/send-email-using-phpmailer-and-codeigniter.png"><img class="aligncenter size-full wp-image-690" alt="send-email-using-phpmailer-and-codeigniter" src="http://www.computersneaker.com/wp-content/uploads/2013/06/send-email-using-phpmailer-and-codeigniter.png" width="345" height="236" /></a></p>
<p>1-      <a href="http://code.google.com/a/apache-extras.org/p/phpmailer/downloads/list">Download PHPmailer</a> from original site.</p>
<p>2-      Extract the downloaded “Zip” file.</p>
<p>3-      Open the extracted file and copy “phpmailer.php” and “class.smtp.php”.</p>
<p>4-      Paste these Two Files in Codeigniter Libraries.</p>
<p style="text-align: center;"><a href="http://www.computersneaker.com/wp-content/uploads/2013/06/Send-email-using-PHPmailer-and-Codeigniter.png"><img class="aligncenter size-full wp-image-689" style="border: 2px solid black;" alt="Send email using PHPmailer and Codeigniter" src="http://www.computersneaker.com/wp-content/uploads/2013/06/Send-email-using-PHPmailer-and-Codeigniter.png" width="304" height="483" /></a></p>
<p>&nbsp;</p>
<p>5-      Now create now controller as I have following one.</p>
<h2><strong>CIPHP.php</strong></h2>
<div id="fvch-codeblock-0" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-0"><span class="php"><span class="php-keyword">if</span> <span class="php-brackets">(</span> <span class="php-operator">!</span> <span class="php-function">defined</span><span class="php-brackets">(</span><span class="php-string">'BASEPATH'</span><span class="php-brackets">)</span><span class="php-brackets">)</span> <span class="php-function">exit</span><span class="php-brackets">(</span><span class="php-string">'No direct script access allowed'</span><span class="php-brackets">)</span>;

<span class="php-keyword">class</span> CIPHP <span class="php-keyword">extends</span> CI_Controller <span class="php-brackets">{</span>

<span class="php-function">function</span> __construct<span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-brackets">{</span>

parent<span class="php-operator">:</span><span class="php-operator">:</span>__construct<span class="php-brackets">(</span><span class="php-brackets">)</span>;

<span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>load<span class="php-operator">-</span><span class="php-operator">&gt;</span>library<span class="php-brackets">(</span><span class="php-string">'phpmailer'</span><span class="php-brackets">)</span>;

<span class="php-brackets">}</span>

<span class="php-function">function</span> send_email<span class="php-brackets">(</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>

<span class="php-var">$subject              </span> <span class="php-operator">=</span>             <span class="php-string">'Test Email'</span>;

<span class="php-var">$name                 </span> <span class="php-operator">=</span>             <span class="php-string">'Engr Mudasir'</span>;

<span class="php-var">$email                  </span> <span class="php-operator">=</span>             <span class="php-string">'mudasir@computersneaker.com'</span>;

<span class="php-var">$body                  </span> <span class="php-operator">=</span>             <span class="php-string">&quot;This si body text for test email to combine CodeIgniter and PHPmailer&quot;</span>;

<span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>phpmailer<span class="php-operator">-</span><span class="php-operator">&gt;</span>AddAddress<span class="php-brackets">(</span><span class="php-var">$email</span><span class="php-brackets">)</span>;

<span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>phpmailer<span class="php-operator">-</span><span class="php-operator">&gt;</span>IsMail<span class="php-brackets">(</span><span class="php-brackets">)</span>;

<span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>phpmailer<span class="php-operator">-</span><span class="php-operator">&gt;</span>From     <span class="php-operator">=</span> <span class="php-string">'info@computersneaker.com'</span>;

<span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>phpmailer<span class="php-operator">-</span><span class="php-operator">&gt;</span>FromName <span class="php-operator">=</span> <span class="php-string">'Computer Sneaker'</span>;

<span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>phpmailer<span class="php-operator">-</span><span class="php-operator">&gt;</span>IsHTML<span class="php-brackets">(</span><span class="php-keyword">true</span><span class="php-brackets">)</span>;

<span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>phpmailer<span class="php-operator">-</span><span class="php-operator">&gt;</span>Subject  <span class="php-operator">=</span>  <span class="php-var">$subject</span>;

<span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>phpmailer<span class="php-operator">-</span><span class="php-operator">&gt;</span>Body     <span class="php-operator">=</span>  <span class="php-var">$body</span>;

<span class="php-var">$this</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>phpmailer<span class="php-operator">-</span><span class="php-operator">&gt;</span>Send<span class="php-brackets">(</span><span class="php-brackets">)</span>;

<span class="php-brackets">}</span>

<span class="php-brackets">}</span></span></pre>
</td>
</tr>
</table>
</div>
<p>You simply need to pass values to this function and email is sent.</p>
<p><a title="Send Email Using PHPMailer" href="http://www.computersneaker.com/send-email-using-phpmailer/">To Read Simple PHPMailer to send email using PHP</a>.</p>
<p>Your controller is ready to send email using PHPMailer. This was simple, If you want to modify this controller, e.g you want to send html pages, you will kindly let me know, I will write another tutorial regarding this.
<div class="shr-publisher-688"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
<p><a href="http://www.computersneaker.com/send-email-using-phpmailer-and-codeigniter/">Send Email Using PHPMailer and Codeigniter</a></p><img src="http://feeds.feedburner.com/~r/computersneaker/~4/W5MEnGt9W9M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.computersneaker.com/send-email-using-phpmailer-and-codeigniter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.computersneaker.com/send-email-using-phpmailer-and-codeigniter/</feedburner:origLink></item>
		<item>
		<title>How to Write Functional Code in PHP</title>
		<link>http://feedproxy.google.com/~r/computersneaker/~3/o4io2IDi5Ws/</link>
		<comments>http://www.computersneaker.com/write-functional-code-in-php/#comments</comments>
		<pubDate>Fri, 07 Jun 2013 17:25:24 +0000</pubDate>
		<dc:creator>Mudasir Nazir</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.computersneaker.com/?p=680</guid>
		<description><![CDATA[<p><p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p>Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state. Functional programming has its roots in lambda calculus, a formal system developed in the 1930s to investigate computability, the Noninterchangeable, function definition, function application, and recursion. Many functional programming languages can be viewed as elaborations on the [...]</p></p><p><a href="http://www.computersneaker.com/write-functional-code-in-php/">How to Write Functional Code in PHP</a></p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><b>Functional programming</b> is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state. Functional programming has its roots in lambda calculus, a formal system developed in the 1930s to investigate computability, the Noninterchangeable, function definition, function application, and recursion. Many functional programming languages can be viewed as elaborations on the lambda calculus.</p>
<p>PHP has the following characteristics that make it support functional programming. They include:</p>
<h3>Anonymous OR  lambda functions:</h3>
<p>They are functions that use internal closure class during their implementation. In latest version of PHP they use the invoke() function. In PHP 5.4.x an anonymous function can be defined inside a class but to access the properties and methods of that class it uses variables like “$this”. Mainly they are classes that do not have a name. The values that are seen by anonymous functions are those that were bound during function definition.</p>
<h3>Closures</h3>
<p>By meaning a closure is similar to an anonymous function but the difference is that a closure encloses some parts of its surroundings (external scope). Since PHP uses early binding by default the values at the external scope can be seen by implementing late binding. This is done by passing by reference the variables outside the scope which is implemented applying the keyword use.</p>
<div id="fvch-codeblock-0" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-line-numbers">
<pre>1
2
3
4
5
6
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-0"><span class="php"><span class="php-var">$variable</span> <span class="php-operator">=</span> <span class="php-number">1</span><span class="php-number">0</span>;
<span class="php-comment">// Create a closure using a variable outside of the scope of the anonymous function.</span>
<span class="php-var">$closure</span> <span class="php-operator">=</span> <span class="php-function">function</span><span class="php-brackets">(</span><span class="php-var">$arg</span><span class="php-brackets">)</span> <span class="php-keyword">use</span> <span class="php-brackets">(</span><span class="php-var">$variable</span><span class="php-brackets">)</span>
<span class="php-brackets">{</span>
Return <span class="php-var">$arg</span> <span class="php-operator">+</span> <span class="php-var">$variable</span>;
<span class="php-brackets">}</span>;</span></pre>
</td>
</tr>
</table>
</div>
<h3>Partial functions and currying</h3>
<p>Partial function is consequent from a general function that takes many variables. In that a partial function has the capacity of fixing most of the variables in a general function.</p>
<p>NOTE: Curry is not a PHP function, but it can be created.</p>
<p>It can be implemented using closures as follows</p>
<div id="fvch-codeblock-1" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-line-numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-1"><span class="php"><span class="php-var">$general_function</span> <span class="php-operator">=</span> <span class="php-function">function</span><span class="php-brackets">(</span><span class="php-var">$a</span>, <span class="php-var">$b</span><span class="php-brackets">)</span><span class="php-brackets">{</span>

Return <span class="php-var">$a</span> <span class="php-operator">*</span> <span class="php-var">$a</span> <span class="php-operator">-</span> <span class="php-var">$b</span> <span class="php-operator">*</span> <span class="php-var">$b</span>;

<span class="php-brackets">}</span>;

<span class="php-var">$partial_function</span> <span class="php-operator">=</span> <span class="php-function">function</span> <span class="php-brackets">(</span><span class="php-var">$a</span><span class="php-brackets">)</span> <span class="php-keyword">use</span> <span class="php-brackets">(</span><span class="php-var">$general_function</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>

Return <span class="php-var">$general_function</span> <span class="php-brackets">(</span><span class="php-var">$a</span>, <span class="php-number">5</span><span class="php-brackets">)</span>;

<span class="php-brackets">}</span>;

<span class="php-comment">//Currying is a technique whereby a function that takes one argument can be created from a function that takes multiple arguments. Example:</span>

<span class="php-var">$add2</span> <span class="php-operator">=</span> curry<span class="php-brackets">(</span><span class="php-var">$add</span>, <span class="php-number">2</span><span class="php-brackets">)</span>; <span class="php-comment">//returns a new function reference, to add(), bound with 2 as the first argument</span>

<span class="php-var">$add2</span> <span class="php-brackets">(</span><span class="php-number">8</span><span class="php-brackets">)</span>; <span class="php-comment">// return 10</span>

<span class="php-operator">&amp;</span>nbsp;</span></pre>
</td>
</tr>
</table>
</div>
<h3>Higher order functions</h3>
<p>Higher order functions are functions that a able of accepting functions as their input parameters. The input function’s parameters must accept the same number of parameters and the output function takes the same number of parameters. Higher order functions are implemented by closures and lambdas.</p>
<h3>Pure functions, immutable data</h3>
<p>It is not effortless to apply this in PHP but to make it feasible one has to avoid state and mutable data.PHP implements pure functions by using variables such as global or static but these variables do not change the inputs and outputs.PHP also implements immutable (unchallengeable) data by defining its variables as constants.</p>
<h3>Recursion</h3>
<p>It is a procedure in programming whereby the output of a problem relies on the outputs of other smaller problems but the smaller problems must be from the same problem. Recursion is used to maintain the state and avoid data mutation. Recursion is not implemented in a structured way rather by function calls.
<div class="shr-publisher-680"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
<p><a href="http://www.computersneaker.com/write-functional-code-in-php/">How to Write Functional Code in PHP</a></p><img src="http://feeds.feedburner.com/~r/computersneaker/~4/o4io2IDi5Ws" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.computersneaker.com/write-functional-code-in-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.computersneaker.com/write-functional-code-in-php/</feedburner:origLink></item>
		<item>
		<title>CodeIgniter Installation</title>
		<link>http://feedproxy.google.com/~r/computersneaker/~3/NZDNwPlms4I/</link>
		<comments>http://www.computersneaker.com/codeigniter-installation/#comments</comments>
		<pubDate>Fri, 31 May 2013 16:25:05 +0000</pubDate>
		<dc:creator>Mudasir Nazir</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.computersneaker.com/?p=669</guid>
		<description><![CDATA[<p><p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p>In our today’s tutorial we will learn about codeigniter installation on our local server or web host. So we need to follow the following steps: =&#62;Download Current version of Codeigniter. =&#62;Unzip Codeigniter folder and then copy in your server root folder e.g C://wamp/htdocs/ =&#62;Now simply rename the folder “e.g myWebsite” =&#62;Here comes the actual phase [...]</p></p><p><a href="http://www.computersneaker.com/codeigniter-installation/">CodeIgniter Installation</a></p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->In our today’s tutorial we will learn about codeigniter installation on our local server or web host.</p>
<p>So we need to follow the following steps:</p>
<ol>
<li><a href="http://ellislab.com/codeigniter/user-guide/installation/downloads.html">=&gt;Download</a> Current version of Codeigniter.</li>
<li>=&gt;Unzip Codeigniter folder and then copy in your server root folder <strong>e.g C://wamp/htdocs/</strong></li>
</ol>
<p style="text-align: center;"><a href="http://www.computersneaker.com/wp-content/uploads/2013/05/codeigniter-installation1.png"><img class="aligncenter  wp-image-670" style="border: 2px solid black;" alt="codeigniter installation1" src="http://www.computersneaker.com/wp-content/uploads/2013/05/codeigniter-installation1.png" width="583" height="302" /></a></p>
<ol>
<li>=&gt;Now simply rename the folder “<strong>e.g myWebsite</strong>”</li>
<li>=&gt;Here comes the actual phase to config items. Open <strong>myWebsite/application/config/config.php</strong></li>
<li>=&gt;Change base_url at line 17</li>
</ol>
<p style="text-align: center;"><a href="http://www.computersneaker.com/wp-content/uploads/2013/05/codeigniter-installation2.png"><img class="aligncenter size-full wp-image-671" style="border: 2px solid black;" alt="codeigniter installation2" src="http://www.computersneaker.com/wp-content/uploads/2013/05/codeigniter-installation2.png" width="583" height="266" /></a></p>
<ol>
<li>=&gt;Now open your browser and follow the URL: <a href="http://localhost/myWebsite/">http://localhost/myWebsite/</a></li>
</ol>
<p style="text-align: center;"><a href="http://www.computersneaker.com/wp-content/uploads/2013/05/codeigniter-installation3.png"><img class="aligncenter  wp-image-672" style="border: 2px solid black;" alt="codeigniter installation3" src="http://www.computersneaker.com/wp-content/uploads/2013/05/codeigniter-installation3.png" width="583" height="438" /></a></p>
<p>Now if it gives welcome message then It means installation was successful else you had missed something and you need to follow the steps again.</p>
<p>&nbsp;
<div class="shr-publisher-669"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
<p><a href="http://www.computersneaker.com/codeigniter-installation/">CodeIgniter Installation</a></p><img src="http://feeds.feedburner.com/~r/computersneaker/~4/NZDNwPlms4I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.computersneaker.com/codeigniter-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.computersneaker.com/codeigniter-installation/</feedburner:origLink></item>
		<item>
		<title>Sorting mysql data using PHP and AJAX</title>
		<link>http://feedproxy.google.com/~r/computersneaker/~3/IuOSziuxfss/</link>
		<comments>http://www.computersneaker.com/sorting-mysql-data-using-php-and-ajax/#comments</comments>
		<pubDate>Thu, 18 Apr 2013 10:07:06 +0000</pubDate>
		<dc:creator>Mudasir Nazir</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.computersneaker.com/?p=658</guid>
		<description><![CDATA[<p><p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p>I am today going to provide Ajax sorting in PHP. I will use a “users”  MySQL table for my tutorial. I will divide my tutorial in few steps so that I can let you understand Sorting using AJAX easily. My very first step is to create a table in MySQL, you can copy this query [...]</p></p><p><a href="http://www.computersneaker.com/sorting-mysql-data-using-php-and-ajax/">Sorting mysql data using PHP and AJAX</a></p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->I am today going to provide Ajax sorting in PHP. I will use a “users”  MySQL table for my tutorial. I will divide my tutorial in few steps so that I can let you understand Sorting using AJAX easily.</p>
<p>My very first step is to create a table in MySQL, you can copy this query and execute this in SQL section of your tool.</p>
<div id="fvch-codeblock-0" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-0"><span class="php">CREATE TABLE IF NOT EXISTS <span class="php-operator">`</span>users<span class="php-operator">`</span> <span class="php-brackets">(</span>

<span class="php-operator">`</span>id<span class="php-operator">`</span> <span class="php-var-type">int</span><span class="php-brackets">(</span><span class="php-number">1</span><span class="php-number">0</span><span class="php-brackets">)</span> NOT NULL AUTO_INCREMENT,

<span class="php-operator">`</span>saluation<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>firstname<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>surname<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>password<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>address<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>address<span class="php-number">2</span><span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>city<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>zip<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>country<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>phone<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>mobile<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>email<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT NULL,

<span class="php-operator">`</span>status<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">2</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> NOT NULL DEFAULT <span class="php-string">'inactive'</span>,

<span class="php-operator">`</span>start_date<span class="php-operator">`</span> timestamp NULL DEFAULT CURRENT_TIMESTAMP,

<span class="php-operator">`</span>expiry_date<span class="php-operator">`</span> datetime DEFAULT NULL,

<span class="php-operator">`</span>last_login<span class="php-operator">`</span> datetime DEFAULT NULL,

<span class="php-operator">`</span>last_logout<span class="php-operator">`</span> datetime DEFAULT NULL,

<span class="php-operator">`</span>flag<span class="php-operator">`</span> varchar<span class="php-brackets">(</span><span class="php-number">5</span><span class="php-number">0</span><span class="php-brackets">)</span> DEFAULT <span class="php-string">'ofline'</span>,

PRIMARY KEY <span class="php-brackets">(</span><span class="php-operator">`</span>id<span class="php-operator">`</span><span class="php-brackets">)</span>

<span class="php-brackets">)</span></span></pre>
</td>
</tr>
</table>
</div>
<p style="text-align: center;"><a href="http://www.computersneaker.com/wp-content/uploads/2013/04/sorting-mysql-data-in-php-and-ajax.jpg"><img class="aligncenter size-full wp-image-663" style="border: 2px solid black;" alt="sorting mysql data in php and ajax" src="http://www.computersneaker.com/wp-content/uploads/2013/04/sorting-mysql-data-in-php-and-ajax.jpg" width="548" height="158" /></a></p>
<p><a href="http://www.lab.computersneaker.com/ajax-sorting/" class="su-button su-button-style-1 su-button-class" style="background-color:#f2263b;border:1px solid #c21e2f;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;" target="_blank"><span style="color:#fee9eb;padding:12px 25px;font-size:18px;height:18px;line-height:18px;border-top:1px solid #fbbec4;border-radius:7px;text-shadow:-1px -1px 0 #c21e2f;-moz-border-radius:7px;-moz-text-shadow:-1px -1px 0 #c21e2f;-webkit-border-radius:7px;-webkit-text-shadow:-1px -1px 0 #c21e2f;">Demo</span></a>                                                                  <a href="http://www.lab.computersneaker.com/ajax-sorting/ajax-sorting.rar" class="su-button su-button-style-1 su-button-class" style="background-color:#f2263b;border:1px solid #c21e2f;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;" target="_blank"><span style="color:#fee9eb;padding:12px 25px;font-size:18px;height:18px;line-height:18px;border-top:1px solid #fbbec4;border-radius:7px;text-shadow:-1px -1px 0 #c21e2f;-moz-border-radius:7px;-moz-text-shadow:-1px -1px 0 #c21e2f;-webkit-border-radius:7px;-webkit-text-shadow:-1px -1px 0 #c21e2f;">Download Code</span></a></p>
<p>Now we have table “users”, insert some dummy values in this table. So that we can have some data to see the demo.</p>
<p>Second step is to <a href="http://www.computersneaker.com/connect-mysql-using-php/">build connection between your PHP files and MySQL server</a>.</p>
<p>You need to create a file named as <em><strong>“config.php”</strong></em> and then copy and paste this code in that file.</p>
<div id="fvch-codeblock-1" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-line-numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-1"><span class="php"><span class="php-var">$servername</span><span class="php-operator">=</span><span class="php-string">'localhost'</span>;

<span class="php-var">$dbusername</span><span class="php-operator">=</span><span class="php-string">'root'</span>;

<span class="php-var">$dbpassword</span><span class="php-operator">=</span><span class="php-string">''</span>;

<span class="php-var">$dbname</span><span class="php-operator">=</span><span class="php-string">'swissmetrics'</span>;

<span class="php-var">$link</span><span class="php-operator">=</span><span class="php-function">mysql_connect</span> <span class="php-brackets">(</span><span class="php-string">&quot;$servername&quot;</span>,<span class="php-string">&quot;$dbusername&quot;</span>,<span class="php-string">&quot;$dbpassword&quot;</span><span class="php-brackets">)</span>;

<span class="php-function">mysql_select_db</span><span class="php-brackets">(</span><span class="php-string">&quot;$dbname&quot;</span>,<span class="php-var">$link</span><span class="php-brackets">)</span><span class="php-operator"> or </span><span class="php-function">die</span> <span class="php-brackets">(</span><span class="php-string">&quot;could not open db&quot;</span><span class="php-operator">.</span>MySQL_error<span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-brackets">)</span>;</span></pre>
</td>
</tr>
</table>
</div>
<p>if you want to understand this connection establishment deeply then read my article “<a href="http://www.computersneaker.com/connect-mysql-using-php/">Connection between MySQL and PHP</a>”</p>
<p>&nbsp;</p>
<p>Third step is to create a file <em>&#8220;<strong>main.php&#8221;</strong></em></p>
<p>And then create a form in that file, just copy and paste this code in main.php</p>
<div id="fvch-codeblock-2" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-line-numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-2"><span class="php"><span class="php-operator">&lt;</span>form name<span class="php-operator">=</span><span class="php-string">&quot;ajaxlearning&quot;</span> id<span class="php-operator">=</span><span class="php-string">&quot;ajaxlearning&quot;</span><span class="php-operator">&gt;</span>

Sort By<span class="php-operator">:</span><span class="php-operator">&lt;</span>select name<span class="php-operator">=</span><span class="php-string">&quot;dropdown&quot;</span> id<span class="php-operator">=</span><span class="php-string">&quot;dropdown&quot;</span> onchange<span class="php-operator">=</span><span class="php-string">&quot;dynamic_Select(this.value)&quot;</span><span class="php-operator">&gt;</span>

<span class="php-operator">&lt;</span>option value<span class="php-operator">=</span><span class="php-string">&quot;&quot;</span><span class="php-operator">&gt;</span>Select Filter<span class="php-operator">&lt;</span><span class="php-operator">/</span>option<span class="php-operator">&gt;</span>

<span class="php-operator">&lt;</span>option value<span class="php-operator">=</span><span class="php-string">&quot;saluation&quot;</span><span class="php-operator">&gt;</span>Saluation<span class="php-operator">&lt;</span><span class="php-operator">/</span>option<span class="php-operator">&gt;</span>

<span class="php-operator">&lt;</span>option value<span class="php-operator">=</span><span class="php-string">&quot;surname&quot;</span><span class="php-operator">&gt;</span>Surname<span class="php-operator">&lt;</span><span class="php-operator">/</span>option<span class="php-operator">&gt;</span>

<span class="php-operator">&lt;</span>option value<span class="php-operator">=</span><span class="php-string">&quot;firstname&quot;</span><span class="php-operator">&gt;</span>First Name<span class="php-operator">&lt;</span><span class="php-operator">/</span>option<span class="php-operator">&gt;</span>

<span class="php-operator">&lt;</span><span class="php-operator">/</span>select<span class="php-operator">&gt;</span>

<span class="php-operator">&lt;</span><span class="php-operator">/</span>form<span class="php-operator">&gt;</span></span></pre>
</td>
</tr>
</table>
</div>
<p>You have observed that there is onchange function called in select of the form. This function is also part of this <em><strong>&#8220;main.php&#8221;</strong></em> File. This function will call ajax method to call the records from another file.</p>
<div id="fvch-codeblock-3" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-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
23
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-3"><span class="html"><span class="html-script-element">&lt;script src=<span class="html-attribute">&quot;http://code.jquery.com/jquery-1.9.1.min.js&quot;</span>&gt;<span class="js"><span class="js"></span></span>&lt;/script&gt;</span>

<span class="html-script-element">&lt;script&gt;<span class="js"><span class="js">

<span class="js-function-keyword">function</span> dynamic_Select<span class="js-bracket">(</span>dropdown<span class="js-bracket">)</span> <span class="js-bracket">{</span>

$.ajax<span class="js-bracket">(</span><span class="js-bracket">{</span>

type<span class="js-operator">:</span> <span class="js-string">&quot;GET&quot;</span>,

url<span class="js-operator">:</span> <span class="js-string">'values.php'</span>,

data<span class="js-operator">:</span> <span class="js-string">&quot;ch=&quot;</span> <span class="js-operator">+</span> dropdown,

dataType<span class="js-operator">:</span> <span class="js-string">&quot;html&quot;</span>,

success<span class="js-operator">:</span> <span class="js-function-keyword">function</span><span class="js-bracket">(</span>html<span class="js-bracket">)</span><span class="js-bracket">{</span>$<span class="js-bracket">(</span><span class="js-string">&quot;#txtResult&quot;</span><span class="js-bracket">)</span>.html<span class="js-bracket">(</span>html<span class="js-bracket">)</span>; $<span class="js-bracket">(</span><span class="js-string">&quot;#firstresult&quot;</span><span class="js-bracket">)</span>.css<span class="js-bracket">(</span><span class="js-string">&quot;display&quot;</span>, <span class="js-string">&quot;none&quot;</span><span class="js-bracket">)</span>;<span class="js-bracket">}</span>

<span class="js-bracket">}</span><span class="js-bracket">)</span>;

<span class="js-bracket">}</span>

</span></span>&lt;/script&gt;</span></span></pre>
</td>
</tr>
</table>
</div>
<p>This will get value of your selected option and then pass that value to the file <em><strong>“values.php”</strong></em>, this file will call the values accordingly. And then display those values on your page without refreshing your page.</p>
<p>Here is the code for <em><strong>&#8220;values.php&#8221;</strong></em>:</p>
<div id="fvch-codeblock-4" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-4"><span class="php"><span class="php-script-tag">&lt;?php</span>

<span class="php-keyword">include</span><span class="php-brackets">(</span><span class="php-string">'config.php'</span><span class="php-brackets">)</span>;

<span class="php-var">$order </span> <span class="php-operator">=</span>             <span class="php-var">$_GET</span><span class="php-brackets">[</span><span class="php-string">'ch'</span><span class="php-brackets">]</span>;

<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$order</span><span class="php-operator">!</span><span class="php-operator">=</span><span class="php-string">''</span><span class="php-brackets">)</span>

<span class="php-brackets">{</span>

<span class="php-var">$query </span> <span class="php-operator">=</span>             <span class="php-string">&quot;SELECT * FROM users Order By $order ASC&quot;</span>;

<span class="php-brackets">}</span>

<span class="php-keyword">else</span>

<span class="php-brackets">{</span>

<span class="php-var">$query </span> <span class="php-operator">=</span>             <span class="php-string">&quot;SELECT * FROM users&quot;</span>;

<span class="php-brackets">}</span>

<span class="php-var">$res      </span> <span class="php-operator">=</span>             <span class="php-function">mysql_query</span><span class="php-brackets">(</span><span class="php-var">$query</span><span class="php-brackets">)</span>;

<span class="php-script-tag">?&gt;<span class="html">

<span class="html-table-element">&lt;table id=<span class="html-attribute">&quot;mytable&quot;</span> cellspacing=<span class="html-attribute">&quot;0&quot;</span> summary=<span class="html-attribute">&quot;Sorting MySQL Data Using PHP and Ajax&quot;</span>&gt;</span>

<span class="html-other-element">&lt;caption&gt;</span>Sorting MySQL Data Using PHP and Ajax<span class="html-other-element">&lt;/caption&gt;</span>

<span class="html-table-element">&lt;tr&gt;</span>

<span class="html-table-element">&lt;th scope=<span class="html-attribute">&quot;col&quot;</span>&gt;</span>Saluation<span class="html-table-element">&lt;/th&gt;</span>

<span class="html-table-element">&lt;th scope=<span class="html-attribute">&quot;col&quot;</span>&gt;</span>Surname<span class="html-table-element">&lt;/th&gt;</span>

<span class="html-table-element">&lt;th scope=<span class="html-attribute">&quot;col&quot;</span>&gt;</span>FirstName<span class="html-table-element">&lt;/th&gt;</span>

<span class="html-table-element">&lt;/tr&gt;</span>

</span>&lt;?php</span>

<span class="php-keyword">while</span><span class="php-brackets">(</span><span class="php-var">$row</span> <span class="php-operator">=</span> <span class="php-function">mysql_fetch_array</span><span class="php-brackets">(</span><span class="php-var">$res</span><span class="php-brackets">)</span><span class="php-brackets">)</span>

<span class="php-brackets">{</span>

<span class="php-keyword">echo</span> <span class="php-string">'&lt;tr&gt;

&lt;td&gt;'</span><span class="php-operator">.</span><span class="php-var">$row</span><span class="php-brackets">[</span><span class="php-string">'saluation'</span><span class="php-brackets">]</span><span class="php-operator">.</span><span class="php-string">'&lt;/td&gt;

&lt;td&gt;'</span><span class="php-operator">.</span><span class="php-var">$row</span><span class="php-brackets">[</span><span class="php-string">'surname'</span><span class="php-brackets">]</span><span class="php-operator">.</span><span class="php-string">'&lt;/td&gt;

&lt;td&gt;'</span><span class="php-operator">.</span><span class="php-var">$row</span><span class="php-brackets">[</span><span class="php-string">'firstname'</span><span class="php-brackets">]</span><span class="php-operator">.</span><span class="php-string">'&lt;/td&gt;

&lt;/tr&gt;'</span>;

<span class="php-brackets">}</span>

<span class="php-script-tag">?&gt;<span class="html">

<span class="html-table-element">&lt;/table&gt;</span></span></span></span></pre>
</td>
</tr>
</table>
</div>
<p><a href="http://www.lab.computersneaker.com/ajax-sorting/" class="su-button su-button-style-1 su-button-class" style="background-color:#f2263b;border:1px solid #c21e2f;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;" target="_blank"><span style="color:#fee9eb;padding:12px 25px;font-size:18px;height:18px;line-height:18px;border-top:1px solid #fbbec4;border-radius:7px;text-shadow:-1px -1px 0 #c21e2f;-moz-border-radius:7px;-moz-text-shadow:-1px -1px 0 #c21e2f;-webkit-border-radius:7px;-webkit-text-shadow:-1px -1px 0 #c21e2f;">Demo</span></a>                                                                  <a href="http://www.lab.computersneaker.com/ajax-sorting/ajax-sorting.rar" class="su-button su-button-style-1 su-button-class" style="background-color:#f2263b;border:1px solid #c21e2f;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;" target="_blank"><span style="color:#fee9eb;padding:12px 25px;font-size:18px;height:18px;line-height:18px;border-top:1px solid #fbbec4;border-radius:7px;text-shadow:-1px -1px 0 #c21e2f;-moz-border-radius:7px;-moz-text-shadow:-1px -1px 0 #c21e2f;-webkit-border-radius:7px;-webkit-text-shadow:-1px -1px 0 #c21e2f;">Download Code</span></a></p>
<p>I hope you will like my tutorial. Please don’t forget to comment and subscribe my blog.
<div class="shr-publisher-658"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
<p><a href="http://www.computersneaker.com/sorting-mysql-data-using-php-and-ajax/">Sorting mysql data using PHP and AJAX</a></p><img src="http://feeds.feedburner.com/~r/computersneaker/~4/IuOSziuxfss" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.computersneaker.com/sorting-mysql-data-using-php-and-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.computersneaker.com/sorting-mysql-data-using-php-and-ajax/</feedburner:origLink></item>
		<item>
		<title>Export MySQL As CSV</title>
		<link>http://feedproxy.google.com/~r/computersneaker/~3/uK862rYAFnQ/</link>
		<comments>http://www.computersneaker.com/export-mysql-as-csv/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 21:16:17 +0000</pubDate>
		<dc:creator>Mudasir Nazir</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.computersneaker.com/?p=646</guid>
		<description><![CDATA[<p><p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p>Export mysql as csv is mostly needed when you need to import data to some other database, wherever you wanted to use. I am giving my today&#8217;s release in that case, this is complete tested code to export MySQL as csv, whatever you need is to change the query section of this code. I hope [...]</p></p><p><a href="http://www.computersneaker.com/export-mysql-as-csv/">Export MySQL As CSV</a></p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->Export mysql as csv is mostly needed when you need to import data to some other database, wherever you wanted to use.</p>
<p>I am giving my today&#8217;s release in that case, this is complete tested code to export MySQL as csv, whatever you need is to change the query section of this code.</p>
<p>I hope it would full fill all your requirements, it it does then do&#8217;t forget to comment.</p>
<p>Here it goes!</p>
<div id="fvch-codeblock-0" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-0"><span class="php"><span class="php-comment">/*

* establish database connection
*/</span>

<span class="php-var">$conn</span> <span class="php-operator">=</span> <span class="php-function">mysql_connect</span><span class="php-brackets">(</span><span class="php-string">'server_name'</span>, <span class="php-string">'server_username'</span>, <span class="php-string">'your_password'</span><span class="php-brackets">)</span><span class="php-operator"> or </span><span class="php-function">die</span><span class="php-brackets">(</span><span class="php-function">mysql_error</span><span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-brackets">)</span>;
<span class="php-function">mysql_select_db</span><span class="php-brackets">(</span><span class="php-string">'Database_name'</span>, <span class="php-var">$conn</span><span class="php-brackets">)</span><span class="php-operator"> or </span><span class="php-function">die</span><span class="php-brackets">(</span><span class="php-function">mysql_error</span><span class="php-brackets">(</span><span class="php-var">$conn</span><span class="php-brackets">)</span><span class="php-brackets">)</span>;

<span class="php-var">$query</span> <span class="php-operator">=</span> <span class="php-string">'SELECT * FROM users'</span>;

<span class="php-var">$result</span> <span class="php-operator">=</span> <span class="php-function">mysql_query</span><span class="php-brackets">(</span><span class="php-var">$query</span>, <span class="php-var">$conn</span><span class="php-brackets">)</span><span class="php-operator"> or </span><span class="php-function">die</span><span class="php-brackets">(</span><span class="php-function">mysql_error</span><span class="php-brackets">(</span><span class="php-var">$conn</span><span class="php-brackets">)</span><span class="php-brackets">)</span>;

<span class="php-comment">/*
* send response headers to the browser
* following headers instruct the browser to treat the data as a csv file called export.csv
*/</span>

<span class="php-function">header</span><span class="php-brackets">(</span><span class="php-string">'Content-Type: text/csv'</span><span class="php-brackets">)</span>;
<span class="php-function">header</span><span class="php-brackets">(</span><span class="php-string">'Content-Disposition: attachment;filename=export.csv'</span><span class="php-brackets">)</span>;

<span class="php-var">$row</span> <span class="php-operator">=</span> <span class="php-function">mysql_fetch_assoc</span><span class="php-brackets">(</span><span class="php-var">$result</span><span class="php-brackets">)</span>;
<span class="php-keyword">if</span> <span class="php-brackets">(</span><span class="php-var">$row</span><span class="php-brackets">)</span>
<span class="php-brackets">{</span>
getcsv<span class="php-brackets">(</span><span class="php-function">array_keys</span><span class="php-brackets">(</span><span class="php-var">$row</span><span class="php-brackets">)</span><span class="php-brackets">)</span>;
<span class="php-brackets">}</span>

<span class="php-operator">&amp;</span>nbsp;

<span class="php-keyword">while</span> <span class="php-brackets">(</span><span class="php-var">$row</span><span class="php-brackets">)</span>
<span class="php-brackets">{</span>
getcsv<span class="php-brackets">(</span><span class="php-var">$row</span><span class="php-brackets">)</span>;
<span class="php-var">$row</span> <span class="php-operator">=</span> <span class="php-function">mysql_fetch_assoc</span><span class="php-brackets">(</span><span class="php-var">$result</span><span class="php-brackets">)</span>;
<span class="php-brackets">}</span>

<span class="php-comment">/*
* echo the input array as csv data maintaining consistency with most CSV implementations
*/</span>

<span class="php-function">function</span> getcsv<span class="php-brackets">(</span><span class="php-var">$fields</span><span class="php-brackets">)</span>
<span class="php-brackets">{</span>
<span class="php-var">$separator</span> <span class="php-operator">=</span> <span class="php-string">''</span>;
<span class="php-keyword">foreach</span> <span class="php-brackets">(</span><span class="php-var">$fields</span> <span class="php-keyword">as</span> <span class="php-var">$field</span><span class="php-brackets">)</span>
<span class="php-brackets">{</span>
<span class="php-keyword">if</span> <span class="php-brackets">(</span><span class="php-function">preg_match</span><span class="php-brackets">(</span><span class="php-string">'/\\r|\\n|,|&quot;/'</span>, <span class="php-var">$field</span><span class="php-brackets">)</span><span class="php-brackets">)</span>
<span class="php-brackets">{</span>
<span class="php-var">$field</span> <span class="php-operator">=</span> <span class="php-string">'&quot;'</span> <span class="php-operator">.</span> <span class="php-function">str_replace</span><span class="php-brackets">(</span><span class="php-string">'&quot;'</span>, <span class="php-string">'&quot;&quot;'</span>, <span class="php-var">$field</span><span class="php-brackets">)</span> <span class="php-operator">.</span> <span class="php-string">'&quot;'</span>;
<span class="php-brackets">}</span>
<span class="php-keyword">echo</span> <span class="php-var">$separator</span> <span class="php-operator">.</span> <span class="php-var">$field</span>;
<span class="php-var">$separator</span> <span class="php-operator">=</span> <span class="php-string">','</span>;
<span class="php-brackets">}</span>
<span class="php-keyword">echo</span> <span class="php-string">&quot;\r\n&quot;</span>;
<span class="php-brackets">}</span></span></pre>
</td>
</tr>
</table>
</div>
<div class="shr-publisher-646"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
<p><a href="http://www.computersneaker.com/export-mysql-as-csv/">Export MySQL As CSV</a></p><img src="http://feeds.feedburner.com/~r/computersneaker/~4/uK862rYAFnQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.computersneaker.com/export-mysql-as-csv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.computersneaker.com/export-mysql-as-csv/</feedburner:origLink></item>
		<item>
		<title>8 Important Places to Add Subscription Box</title>
		<link>http://feedproxy.google.com/~r/computersneaker/~3/oBbUVi10TLo/</link>
		<comments>http://www.computersneaker.com/important-places-to-add-subscription-box/#comments</comments>
		<pubDate>Sun, 24 Mar 2013 21:18:56 +0000</pubDate>
		<dc:creator>Mudasir Nazir</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Make Money]]></category>

		<guid isPermaLink="false">http://www.computersneaker.com/?p=636</guid>
		<description><![CDATA[<p><p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p>Money is in the list of every single person in the world. All of us know this. That’s why you should care about increasing your subscribers if you are running a blog. A lot of blogs shows to you the most common places to add your subscription box, but I thought why don’t we share [...]</p></p><p><a href="http://www.computersneaker.com/important-places-to-add-subscription-box/">8 Important Places to Add Subscription Box</a></p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->
<p>Money is in the list of every single person in the world.</p>
<p>All of us know this. That’s why you should care about increasing your subscribers if you are running a blog.</p>
<p>A lot of blogs shows to you the most common places to add your subscription box, but I thought why don’t we share the rarely used places and that can bring us more subscribers.</p>
<p>So, <em>usual places + unusual places = more subscribers</em> and most importantly more money.</p>
<p>If you are actually looking for places to increase your subscribers, you are on the right place.</p>
<p>Let’s start with an additional benefit and show you the most common places:</p>
<h2>1- On the sidebar “but at the top”:</h2>
<p>so that new visitors will check it after they enter your site.</p>
<h2>2- After the post:</h2>
<p><strong></strong> If a reader read all the post to the end then he may like your stuff and he may want to get further updates, so this is the place to ask them to subscribe.</p>
<h2>3- Popup Box:</h2>
<p>I think that no one these days doesn’t use these boxes, It attracts attention of your first time visitors + you have a lot of space to show them the features of signing up to your blog.</p>
<p>But now what are the 5 Unusual But Important Places to Add Subscription Box? Let’s see them:</p>
<h2>4- Feature Box:</h2>
<p>Feature Box is the box that is at the top of your blog after the header directly. It attracts attention, and you have a big place to share with your reader what will they get from subscribing.</p>
<p>Many had started to use it, but also not that much. That’s why it isn’t common. I encourage you to try it.</p>
<h2>5- About pages:</h2>
<p>Yes, about pages, but there is a big question mark that how this page helps you to get more subscribers?</p>
<p>If a new reader came across your blog, he may go to your about page to know more about your site. If they did not like it, then no problem. But what if they liked it, will you let them to go away without subscribing your blog?</p>
<p>If they liked it, this mean they can be your super readers, so don’t leave them go without any action.</p>
<h2>6- Other landing pages:</h2>
<p>If you have content landing pages, or what Brian Clark call cornerstone content, then you must add your subscription box there too.</p>
<p>It maybe any other pages “not only cornerstone content”, it maybe your page that you shows in it your income every month, like this one by Pat Flynn “<a href="http://www.smartpassiveincome.com/my-income-reports/" target="_blank">Income Reports</a>“.</p>
<p>You show people that you want business, and that you create content that they like, so ask them to subscribe.</p>
<h2>7- Top Bar:</h2>
<p>I think you may have heard about HelloBar.</p>
<p>Yes, that bar that appears at the top of your blog.</p>
<p>There is no well place than this to ask your readers to subscribe. Forward them to a page which shows them what will they get and then ask them to subscribe.</p>
<p>The best thing about it is that it can be scrolling all the way down with the reader, so if you reader liked your content, then he will click on it.</p>
<h2>8- Footer of your site:</h2>
<p>The footer, why?</p>
<p>If someone scrolled all the way down then he might be interested to subscribe.</p>
<h2>Conclusion:</h2>
<p>These were some of the places to add your subscription box and increase subscribers. Some of them may seem common, but maximum of the blogs don’t use it.</p>
<p>I don’t use them all and I don’t encourage you to do so, but try them and test the one that increases your subscribers.</p>
<p>Now, its your turn to tell us about any other place we may have missed, also tell us about the places that you are using  plus the places you will try to use.</p>
<p>&nbsp;</p>
<div class="shr-publisher-636"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
<p><a href="http://www.computersneaker.com/important-places-to-add-subscription-box/">8 Important Places to Add Subscription Box</a></p><img src="http://feeds.feedburner.com/~r/computersneaker/~4/oBbUVi10TLo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.computersneaker.com/important-places-to-add-subscription-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.computersneaker.com/important-places-to-add-subscription-box/</feedburner:origLink></item>
		<item>
		<title>Send Email Using PHPMailer</title>
		<link>http://feedproxy.google.com/~r/computersneaker/~3/Nob4_gLfxXk/</link>
		<comments>http://www.computersneaker.com/send-email-using-phpmailer/#comments</comments>
		<pubDate>Sun, 24 Feb 2013 17:35:51 +0000</pubDate>
		<dc:creator>Mudasir Nazir</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.computersneaker.com/?p=606</guid>
		<description><![CDATA[<p><p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p>I am happy to write about PHPMailer class, let&#8217;s learn that how to send and email using PHPMailer. In this tutorial we will talk about how to use HTML Templates as an email, attatch files with your email using PHPMailer. Here we will use the following files to as sample for newbies. index.php send_email.php contents.html [...]</p></p><p><a href="http://www.computersneaker.com/send-email-using-phpmailer/">Send Email Using PHPMailer</a></p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->I am happy to write about PHPMailer class, let&#8217;s learn that how to send and email using PHPMailer. In this tutorial we will talk about how to use HTML Templates as an email, attatch files with your email using PHPMailer. Here we will use the following files to as sample for newbies.</p>
<ul>
<li><span style="line-height: 13px;">index.php</span></li>
<li>send_email.php</li>
<li>contents.html</li>
<li>images/logo1.png</li>
<li>images/engr_mudasir.jpg</li>
</ul>
<p>Our index file contains a form that will ask for an email address and on submit it will send an email to your email address you entered. In any other constraint you could say that it is front end page.</p>
<p><a href="http://www.lab.computersneaker.com/send_email_using_phpMailer/" class="su-button su-button-style-1 su-button-class" style="background-color:#f2263b;border:1px solid #c21e2f;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;" target="_blank"><span style="color:#fee9eb;padding:12px 25px;font-size:18px;height:18px;line-height:18px;border-top:1px solid #fbbec4;border-radius:7px;text-shadow:-1px -1px 0 #c21e2f;-moz-border-radius:7px;-moz-text-shadow:-1px -1px 0 #c21e2f;-webkit-border-radius:7px;-webkit-text-shadow:-1px -1px 0 #c21e2f;">Demo</span></a>                                                                  <a href="http://www.lab.computersneaker.com/send_email_using_phpMailer/email_using_phpMailer.rar" class="su-button su-button-style-1 su-button-class" style="background-color:#f2263b;border:1px solid #c21e2f;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;" target="_blank"><span style="color:#fee9eb;padding:12px 25px;font-size:18px;height:18px;line-height:18px;border-top:1px solid #fbbec4;border-radius:7px;text-shadow:-1px -1px 0 #c21e2f;-moz-border-radius:7px;-moz-text-shadow:-1px -1px 0 #c21e2f;-webkit-border-radius:7px;-webkit-text-shadow:-1px -1px 0 #c21e2f;">Download Code</span></a></p>
<h3>index.php</h3>
<div id="fvch-codeblock-0" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-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
23
24
25
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-0"><span class="html"><span class="html-other-element">&lt;html&gt;</span>
<span class="html-other-element">&lt;head&gt;</span>
<span class="html-other-element">&lt;title&gt;</span>Send and Email Using PHPMaier<span class="html-other-element">&lt;/title&gt;</span>
<span class="html-other-element">&lt;/head&gt;</span>
<span class="html-other-element">&lt;body&gt;</span>
<span class="html-other-element">&lt;h2&gt;</span>Send an Email Using PHPMailer Demo<span class="html-other-element">&lt;/h2&gt;</span>
<span class="html-form-element">&lt;form enctype=<span class="html-attribute">&quot;multipart/form-data&quot;</span> method=<span class="html-attribute">&quot;post&quot;</span> action=<span class="html-attribute">&quot;send_mail.php&quot;</span>&gt;</span>
<span class="html-table-element">&lt;table width=<span class="html-attribute">&quot;461&quot;</span> height=<span class="html-attribute">&quot;138&quot;</span> border=<span class="html-attribute">&quot;1&quot;</span>&gt;</span>
<span class="html-table-element">&lt;tr&gt;</span>
<span class="html-table-element">&lt;td width=<span class="html-attribute">&quot;141&quot;</span>&gt;</span>Enter Your Email Here<span class="html-table-element">&lt;/td&gt;</span>
<span class="html-table-element">&lt;td width=<span class="html-attribute">&quot;187&quot;</span>&gt;</span>
<span class="html-form-element">&lt;input name=<span class="html-attribute">&quot;email&quot;</span> id=<span class="html-attribute">&quot;email&quot;</span> type=<span class="html-attribute">&quot;text&quot;</span> /&gt;</span>
<span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;submit&quot;</span> name=<span class="html-attribute">&quot;btnsend&quot;</span> id=<span class="html-attribute">&quot;btnsend&quot;</span> value=<span class="html-attribute">&quot;Send Email&quot;</span> /&gt;</span><span class="html-table-element">&lt;/td&gt;</span>
<span class="html-table-element">&lt;/tr&gt;</span>
<span class="html-table-element">&lt;tr&gt;</span>
<span class="html-table-element">&lt;td colspan=<span class="html-attribute">&quot;2&quot;</span>&gt;</span><span class="html-special-char">&amp;nbsp;</span><span class="html-table-element">&lt;/td&gt;</span>
<span class="html-table-element">&lt;/tr&gt;</span>
<span class="html-table-element">&lt;tr&gt;</span>
<span class="html-table-element">&lt;td&gt;</span><span class="html-anchor-element">&lt;a href=<span class="html-attribute">&quot;&quot;</span>&gt;</span>Main Tutorial Here<span class="html-anchor-element">&lt;/a&gt;</span><span class="html-table-element">&lt;/td&gt;</span>
<span class="html-table-element">&lt;td&gt;</span><span class="html-anchor-element">&lt;a href=<span class="html-attribute">&quot;http://www.engrmudasir.computersneaker.com&quot;</span>&gt;</span>By Engr Mudasir<span class="html-anchor-element">&lt;/a&gt;</span><span class="html-table-element">&lt;/td&gt;</span>
<span class="html-table-element">&lt;/tr&gt;</span>
<span class="html-table-element">&lt;/table&gt;</span>
<span class="html-form-element">&lt;/form&gt;</span>
<span class="html-other-element">&lt;/body&gt;</span>
<span class="html-other-element">&lt;/html&gt;</span></span></pre>
</td>
</tr>
</table>
</div>
<p>Our second file contains contents to send to the user as email body, this contains an image too.</p>
<h3>contents.html</h3>
<div id="fvch-codeblock-1" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-line-numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-1"><span class="html"><span class="html-other-element">&lt;body style=<span class="html-attribute">&quot;<span class="css"><span class="css"><span class="css-property">margin<span class="css-selector">:</span><span class="css-value"> 10px</span></span>;</span></span>&quot;</span>&gt;</span>
<span class="html-other-element">&lt;div style=<span class="html-attribute">&quot;<span class="css"><span class="css"><span class="css-property">width<span class="css-selector">:</span><span class="css-value"> 640px</span></span>; <span class="css-property">font-family<span class="css-selector">:</span><span class="css-value"> Arial, Helvetica, sans-serif</span></span>; <span class="css-property">font-size<span class="css-selector">:</span><span class="css-value"> 11px</span></span>;</span></span>&quot;</span>&gt;</span>
<span class="html-other-element">&lt;div align=<span class="html-attribute">&quot;center&quot;</span>&gt;</span><span class="html-image-element">&lt;img src=<span class="html-attribute">&quot;images/logo1.png&quot;</span> style=<span class="html-attribute">&quot;<span class="css"><span class="css">height: 90px; <span class="css-property">width<span class="css-selector">:</span><span class="css-value"> 340p</span</span></span></span>&quot;</span>&gt;</span><span class="html-other-element">&lt;/div&gt;</span><span class="html-other-element">&lt;br&gt;</span>
<span class="html-other-element">&lt;br&gt;</span>
<span class="html-special-char">&amp;nbsp;</span>This is a Demo of PHPMailer.<span class="html-other-element">&lt;br&gt;</span>
<span class="html-other-element">&lt;br&gt;</span>
This particular example uses <span class="html-other-element">&lt;strong&gt;</span>HTML<span class="html-other-element">&lt;/strong&gt;</span>, with a <span class="html-special-char">&amp;lt;</span>div<span class="html-special-char">&amp;gt;</span> tag and inline<span class="html-other-element">&lt;br&gt;</span>
styles.<span class="html-other-element">&lt;br&gt;</span>
<span class="html-other-element">&lt;br&gt;</span>
Also note the use of the PHPMailer logo above with no specific code to handle
including it.<span class="html-other-element">&lt;br /&gt;</span>
Included are two attachments:<span class="html-other-element">&lt;br /&gt;</span>
logo1.png is an attachment and used inline as a graphic (above)<span class="html-other-element">&lt;br /&gt;</span>
engr_mudasir.jpg is an attachment<span class="html-other-element">&lt;br /&gt;</span>
<span class="html-other-element">&lt;br /&gt;</span>
<span class="html-other-element">&lt;/div&gt;</span>
<span class="html-other-element">&lt;/body&gt;</span></span></pre>
</td>
</tr>
</table>
</div>
<p>Third file is action for the above form, this action file will send an email to the email address entered in the form.</p>
<p>Include the PHPMailer class and create an object for the PHPMailer class. Object will call the functions from the PHPMailer class. Defined are the characteristics to be used and keep in focus to send email.</p>
<h3>send_email.php</h3>
<div id="fvch-codeblock-2" class="fvch-codeblock">
<table>
<tr>
<td class="fvch-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
23
24
25
26
27
28
</pre>
</td>
<td class="fvch-code">
<pre id="fvch-code-2"><span class="php"><span class="php-keyword">require_once</span><span class="php-brackets">(</span><span class="php-string">'class.phpmailer.php'</span><span class="php-brackets">)</span>;
<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-keyword">isset</span><span class="php-brackets">(</span><span class="php-var">$_POST</span><span class="php-brackets">[</span><span class="php-string">'btnsend'</span><span class="php-brackets">]</span><span class="php-brackets">)</span><span class="php-brackets">)</span>
<span class="php-brackets">{</span>
<span class="php-var">$mail</span> <span class="php-operator">=</span> <span class="php-keyword">new</span> PHPMailer<span class="php-brackets">(</span><span class="php-brackets">)</span>; <span class="php-comment">// defaults to using php &quot;mail()&quot;</span>

<span class="php-var">$body</span> <span class="php-operator">=</span> <span class="php-function">file_get_contents</span><span class="php-brackets">(</span><span class="php-string">'contents.html'</span><span class="php-brackets">)</span>;

<span class="php-var">$mail</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>SetFrom<span class="php-brackets">(</span><span class="php-string">'engrmudasirmalik@gmail.com'</span>, <span class="php-string">'ComputerSneaker.com'</span><span class="php-brackets">)</span>;

<span class="php-var">$address</span> <span class="php-operator">=</span> <span class="php-var">$_POST</span><span class="php-brackets">[</span><span class="php-string">'email'</span><span class="php-brackets">]</span>;
<span class="php-var">$mail</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>AddAddress<span class="php-brackets">(</span><span class="php-var">$address</span>, <span class="php-string">&quot;Guest&quot;</span><span class="php-brackets">)</span>;

<span class="php-var">$mail</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>Subject <span class="php-operator">=</span> <span class="php-string">&quot;PHPMailer Demo Test From ComputerSneaker&quot;</span>;

<span class="php-var">$mail</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>AltBody <span class="php-operator">=</span> <span class="php-string">&quot;To view the message, please use an HTML compatible email viewer!&quot;</span>; <span class="php-comment">// optional</span>

<span class="php-var">$mail</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>MsgHTML<span class="php-brackets">(</span><span class="php-var">$body</span><span class="php-brackets">)</span>;

<span class="php-var">$mail</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>AddAttachment<span class="php-brackets">(</span><span class="php-string">&quot;images/logo1.png&quot;</span><span class="php-brackets">)</span>; <span class="php-comment">// attachment</span>
<span class="php-var">$mail</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>AddAttachment<span class="php-brackets">(</span><span class="php-string">&quot;images/engr mudasir.jpg&quot;</span><span class="php-brackets">)</span>; <span class="php-comment">// attachment</span>

<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-operator">!</span><span class="php-var">$mail</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>Send<span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>
<span class="php-keyword">echo</span> <span class="php-string">&quot;Mailer Error: &quot;</span> <span class="php-operator">.</span> <span class="php-var">$mail</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>ErrorInfo;
<span class="php-brackets">}</span> <span class="php-keyword">else</span> <span class="php-brackets">{</span>
<span class="php-keyword">echo</span> <span class="php-string">&quot;A test email sent to your email address '&quot;</span><span class="php-operator">.</span><span class="php-var">$_POST</span><span class="php-brackets">[</span><span class="php-string">'email'</span><span class="php-brackets">]</span><span class="php-operator">.</span><span class="php-string">&quot;' Please Check Email and Spam too.&quot;</span>;
<span class="php-keyword">echo</span> <span class="php-string">'&amp;lt;meta http-equiv=&quot;refresh&quot; content=&quot;5;url=http://www.computersneaker.com/send-email-using-phpmailer/&quot;&amp;gt;'</span>;
<span class="php-brackets">}</span>
<span class="php-brackets">}</span></span></pre>
</td>
</tr>
</table>
</div>
<p><a href="http://www.lab.computersneaker.com/send_email_using_phpMailer/" class="su-button su-button-style-1 su-button-class" style="background-color:#f2263b;border:1px solid #c21e2f;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;" target="_blank"><span style="color:#fee9eb;padding:12px 25px;font-size:18px;height:18px;line-height:18px;border-top:1px solid #fbbec4;border-radius:7px;text-shadow:-1px -1px 0 #c21e2f;-moz-border-radius:7px;-moz-text-shadow:-1px -1px 0 #c21e2f;-webkit-border-radius:7px;-webkit-text-shadow:-1px -1px 0 #c21e2f;">Demo</span></a>                                                                  <a href="http://www.lab.computersneaker.com/send_email_using_phpMailer/email_using_phpMailer.rar" class="su-button su-button-style-1 su-button-class" style="background-color:#f2263b;border:1px solid #c21e2f;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;" target="_blank"><span style="color:#fee9eb;padding:12px 25px;font-size:18px;height:18px;line-height:18px;border-top:1px solid #fbbec4;border-radius:7px;text-shadow:-1px -1px 0 #c21e2f;-moz-border-radius:7px;-moz-text-shadow:-1px -1px 0 #c21e2f;-webkit-border-radius:7px;-webkit-text-shadow:-1px -1px 0 #c21e2f;">Download Code</span></a></p>
<p>And here comes the email as Email Body :</p>
<p style="text-align: center;"><a href="http://www.computersneaker.com/wp-content/uploads/2013/02/send-email-using-phpmailer.jpg"><img class="aligncenter  wp-image-607" style="border: 2px solid black;" alt="send email using phpmailer" src="http://www.computersneaker.com/wp-content/uploads/2013/02/send-email-using-phpmailer.jpg" width="650" height="450" /></a></p>
<p>I hope you enjoyed this tutorial, don&#8217;t forget to provide feedback and subscribe for our blog.
<div class="shr-publisher-606"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
<p><a href="http://www.computersneaker.com/send-email-using-phpmailer/">Send Email Using PHPMailer</a></p><img src="http://feeds.feedburner.com/~r/computersneaker/~4/Nob4_gLfxXk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.computersneaker.com/send-email-using-phpmailer/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://www.computersneaker.com/send-email-using-phpmailer/</feedburner:origLink></item>
		<item>
		<title>Learn Blogging Right Now</title>
		<link>http://feedproxy.google.com/~r/computersneaker/~3/_uSP59j41AI/</link>
		<comments>http://www.computersneaker.com/learn-blogging-right-now/#comments</comments>
		<pubDate>Mon, 14 Jan 2013 07:22:52 +0000</pubDate>
		<dc:creator>Mudasir Nazir</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.computersneaker.com/?p=562</guid>
		<description><![CDATA[<p><p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p>Blogging is a very pretty source since it gives you an chance to share your voice and views on any topic. It is also becoming more and more popular by every passing day. Many people want to start blogging but they are not sure of how to start with it. What to do, how to [...]</p></p><p><a href="http://www.computersneaker.com/learn-blogging-right-now/">Learn Blogging Right Now</a></p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.computersneaker.com">PHP Scripts - WordPress Tutorials</a></p><p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->Blogging is a very pretty source since it gives you an chance to share your voice and views on any topic. It is also becoming more and more popular by every passing day. Many people want to start blogging but they are not sure of how to start with it. What to do, how to do and things like that. If you want to start blogging, I would suggest you to start with a wordpress.com blog. You can start with a blog in no cost at wordpress.com and it provides all that you need to start blogging. There are certain restrictions of having a blog at wordpress.com like you don’t have all the controls, you can’t display ads etc. and that’s why people who are professional bloggers go for self hosted blogs but if you are beginner then a wordpress.com blog will be more than enough for you.<br />
What? Don’t know how to start with a wordpress.com blog? No problem, WordPress is here to help you.</p>
<p style="text-align: center;"><a href="http://www.computersneaker.com/wp-content/uploads/2013/01/how-to-blog-blackboard.jpg"><img class="aligncenter  wp-image-563" style="border: 2px solid black;" alt="how-to-blog-blackboard" src="http://www.computersneaker.com/wp-content/uploads/2013/01/how-to-blog-blackboard.jpg" width="650" height="368" /></a></p>
<p>WordPress <a href="http://en.blog.wordpress.com/2011/01/14/want-to-share-learn-wordpress/">announced</a> the launch of <a href="http://learn.wordpress.com/">Learn WordPress</a> , A step-by-step tutorial that includes lessons on how to start a blog, customize your site, and connect with other bloggers in the WordPress.com community. It’s a great resource for anyone who:</p>
<ul>
<li> Wants to create a blog but isn’t quite sure where to start</li>
<li> Needs help choosing a blog topic</li>
<li> Wants to better understand how blogging works</li>
<li> Is interested in attracting more blog visitors</li>
</ul>
<p style="text-align: left;">It is a very well-organized book kind of guide which you can go through to learn blogging and WordPress.</p>
<div class="shr-publisher-562"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
<p><a href="http://www.computersneaker.com/learn-blogging-right-now/">Learn Blogging Right Now</a></p><img src="http://feeds.feedburner.com/~r/computersneaker/~4/_uSP59j41AI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.computersneaker.com/learn-blogging-right-now/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.computersneaker.com/learn-blogging-right-now/</feedburner:origLink></item>
	</channel>
</rss>
