<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Last Webdesigner a blog about Web Design &#187; PhP</title>
	<atom:link href="http://lastwebdesigner.com/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://lastwebdesigner.com</link>
	<description>Resources for web designers</description>
	<lastBuildDate>Wed, 19 Aug 2009 10:19:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to send a mail with php ajax and jquery in facebook style</title>
		<link>http://lastwebdesigner.com/jquery/how-to-send-a-mail-with-php-ajax-and-jquery-in-facebook-style.html</link>
		<comments>http://lastwebdesigner.com/jquery/how-to-send-a-mail-with-php-ajax-and-jquery-in-facebook-style.html#comments</comments>
		<pubDate>Tue, 16 Jun 2009 15:17:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Jquery]]></category>
		<category><![CDATA[PhP]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://lastwebdesigner.com/?p=197</guid>
		<description><![CDATA[One of the website that I love is facebook. I&#8217;m not talking about the social network, well I like this social network, but I prefer twitter and linkedin for &#8220;professional use&#8221;, but this is another question, because I&#8217;m talking about the design.:) The use of web 2.0 effects and Ajax make this web site on [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>One of the website that I love is <strong>facebook</strong>. I&#8217;m not talking about the <strong>social network, well I like this social network, but I prefer twitter and linkedin for &#8220;professional use&#8221;, but this is another question, because I&#8217;m talking about</strong> the design.:)</p>
<p>The use of <strong>web 2.0 effects</strong> and <strong>Ajax</strong> make this web site on of my favourites.</p>
<p>With this tutorial I will explain you<span style="text-decoration: underline;"><strong> how to create a message mail system like Facebook. <span id="more-197"></span><br />
</strong></span></p>
<p><span style="text-decoration: underline;"><strong> </strong></span>For make this we need to create some files.</p>
<h4>1. The index file with the mail form.</h4>
<h4>2.The mail.php file that process the form and send the mail, using the simple function mail() of php.</h4>
<h4>3.A css file .</h4>
<h4>4.Jquery, naturally.</h4>
<h4>5.An other Javascript, called Ajax.js, to interact with ajax, php and jquery.</h4>
<p>Surely you can put all in one file, but, for a better understanding and to have a clean code, I prefer to use different files for each one.</p>
<p>Well first of all <a title="send a mail with php jquery and ajax" href="http://lastwebdesigner.com/tests/mail-jquery-php-ajax/">you can see a demo of this page here, </a>for logical reason<span style="text-decoration: underline;"><strong> I&#8217;ve deleted my mail from the source code</strong></span>, / you can use your mail to test the script) this is the only thing that you need to change before use the source code, the rest is ready for use.</p>
<p> <img src='http://lastwebdesigner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' title="How to send a mail with php ajax and jquery in facebook style" /> </p>
<p>OK, start with this tutorial.  First we need to create the form page and link to this page the <strong>jquery</strong> and <strong>ajax,js script, </strong>so this is the code :</p>
<blockquote><p><strong>&lt;div&gt;<br />
&lt;div id=&#8221;response&#8221;&gt;</strong></p>
<p><strong>&lt;/div&gt;<br />
&lt;form id=&#8221;formail&#8221; action=&#8221;" method =&#8221;post&#8221;&gt;<br />
&lt;label&gt;Name : &lt;/label&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;name&#8221; id=&#8221;name&#8221; /&gt;<br />
&lt;label&gt;Your mail :&lt;/label&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;mail&#8221; id=&#8221;mail&#8221; /&gt;<br />
&lt;label&gt;Subject : &lt;/label&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;subject&#8221; id=&#8221;subject&#8221; /&gt;<br />
&lt;label&gt;Text :&lt;/label&gt;<br />
&lt;textarea name=&#8221;text&#8221; id=&#8221;text&#8221; cols=&#8221;40&#8243; rows=&#8221;10&#8243;&gt;&lt;/textarea&gt;<br />
&lt;input type=&#8221;submit&#8221; value=&#8221;send mail&#8221; id=&#8221;sendmail&#8221; name=&#8221;sendmail&#8221; /&gt;<br />
&lt;/form&gt;<br />
&lt;/div&gt;</strong></p>
<p><strong>&lt;/div&gt;</strong></p></blockquote>
<p>The <strong>div</strong> called <strong>response</strong>, will be util for the validation and the text message after send the mail( or to get the error if the mail script doesn&#8217;t work), this <strong>div</strong> is really important don&#8217;t forget this.</p>
<p>Now we need to style this, you can style the form as you want, but the only important thing is that the<span style="text-decoration: underline;"> div response must be in display none</span> :</p>
<blockquote><p><strong>#response{display:none;}</strong></p></blockquote>
<p>Is better if you style this and the form, it will look more pretty this is the complete css that I&#8217;ve used :</p>
<blockquote><p><strong>body{<br />
background: #E7E7DC;<br />
font-size: 13px;<br />
font-family: arial;<br />
}<br />
#wrap{<br />
width: 800px;<br />
background: white;<br />
margin: auto;<br />
padding: 10px;<br />
}<br />
#wrap h1{<br />
padding: 10px;<br />
border: 1px solid #ccc;<br />
background: #f8f8f8;<br />
}<br />
.mail{<br />
width:500px;<br />
margin:auto;<br />
}<br />
#formail{<br />
width: 500px;<br />
margin: auto;<br />
}<br />
#formail label{<br />
display: block;<br />
margin: 10px 0;<br />
}<br />
#text{<br />
background: #f8f8f8;<br />
}<br />
#sendmail{<br />
margin-top: 20px;<br />
display: block;<br />
}<br />
#response{<br />
display: none;<br />
border: 1px solid #ccc;<br />
background: #FFFFA0;<br />
padding: 10px;<br />
width: 450px;<br />
}</strong></p></blockquote>
<p>This is the style of the page, now it comes the nice part, the php and the ajax, this will be funny! Let&#8217;s go and create the mail.php page, with this code :</p>
<blockquote><p><strong>&lt;?php<br />
$mail = $_POST['mail'];<br />
$name = $_POST['name'];<br />
$subject = $_POST['subject'];<br />
$text = $_POST['text'];</strong></p>
<p><strong>$to = &#8220;yourmail@domain.com&#8221;;<br />
$message =&#8221; You received  a mail from &#8220;.$mail;<br />
$message .=&#8221; Text of the message : &#8220;.$text;</strong></p>
<p><strong>if(mail($to, $subject,$message)){<br />
echo &#8220;mail successful send&#8221;;<br />
}<br />
else{<br />
echo &#8220;there&#8217;s some errors to send the mail, verify your server options&#8221;;<br />
}<br />
?&gt;</strong></p></blockquote>
<p>Ok, let me explain this:</p>
<p>Firs I create the variables that will contain the froms data values :</p>
<blockquote><p><strong>$mail = $_POST['mail'];<br />
$name = $_POST['name'];<br />
$subject = $_POST['subject'];<br />
$text = $_POST['text'];</strong></p></blockquote>
<p>With the variable<strong> $to</strong>, I store the mail where I want that the mail will be sended( my mail), <span style="text-decoration: underline;">this is the only thing that you must change to make works the script.</span></p>
<p>The <strong>$message</strong> variable get  the <strong>mail</strong> and the text of the <strong>sender</strong>, and put in the body of the mail message.</p>
<p>Finally , with tha <strong>mail() </strong>function from php I send the mail. I&#8217;ve used an if because, <strong>if the mail doesn&#8217;t work you will know. </strong></p>
<p>The mail function is really simple and accept some parameters, the mail where send, the subject and the message of the mail.</p>
<p><a title="mail function php" href="http://es2.php.net/manual/en/function.mail.php">You can read all from the official page of php. </a></p>
<blockquote><p>Now is the time of the<strong> ajax.js.</strong> This is the complete code :</p>
<p><strong>$(document).ready(function(){<br />
$(&#8220;#sendmail&#8221;).click(function(){<br />
var valid = &#8221;;<br />
var isr = &#8216; is required.&#8217;;<br />
var name = $(&#8220;#name&#8221;).val();<br />
var mail = $(&#8220;#mail&#8221;).val();<br />
var subject = $(&#8220;#subject&#8221;).val();<br />
var text = $(&#8220;#text&#8221;).val();<br />
if (name.length&lt;1) {<br />
valid += &#8216;&lt;br /&gt;Name&#8217;+isr;<br />
}<br />
if (!mail.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i)) {<br />
valid += &#8216;&lt;br /&gt;A valid Email&#8217;+isr;<br />
}<br />
if (subject.length&lt;1) {<br />
valid += &#8216;&lt;br /&gt;Subject&#8217;+isr;<br />
}<br />
if (text.length&lt;1) {<br />
valid += &#8216;&lt;br /&gt;Text&#8217;+isr;<br />
}<br />
if (valid!=&#8221;) {<br />
$(&#8220;#response&#8221;).fadeIn(&#8220;slow&#8221;);<br />
$(&#8220;#response&#8221;).html(&#8220;Error:&#8221;+valid);<br />
}<br />
else {<br />
var datastr =&#8217;name=&#8217; + name + &#8216;&amp;mail=&#8217; + mail + &#8216;&amp;subject=&#8217; + subject + &#8216;&amp;text=&#8217; + text;<br />
$(&#8220;#response&#8221;).css(&#8220;display&#8221;, &#8220;block&#8221;);<br />
$(&#8220;#response&#8221;).html(&#8220;Sending message &#8230;. &#8220;);<br />
$(&#8220;#response&#8221;).fadeIn(&#8220;slow&#8221;);<br />
setTimeout(&#8220;send(&#8216;&#8221;+datastr+&#8221;&#8216;)&#8221;,2000);<br />
}<br />
return false;<br />
});<br />
});<br />
function send(datastr){<br />
$.ajax({<br />
type: &#8220;POST&#8221;,<br />
url: &#8220;mail.php&#8221;,<br />
data: datastr,<br />
cache: false,<br />
success: function(html){<br />
$(&#8220;#response&#8221;).fadeIn(&#8220;slow&#8221;);<br />
$(&#8220;#response&#8221;).html(html);<br />
setTimeout(&#8216;$(&#8220;#response&#8221;).fadeOut(&#8220;slow&#8221;)&#8217;,2000);<br />
}<br />
});<br />
}</strong></p></blockquote>
<p>What i&#8217;ve done? let me explain :</p>
<p>I suppose that you know the<strong> $(document).ready function of jquery,</strong> I&#8217;ve explained in the previous tutorial, <a title="animated menu jquery" href="http://lastwebdesigner.com/jquery/simple-animated-menu-with-jquery.html">create an animated menu with jquery</a>.</p>
<p>When <strong>#sendmail,</strong> the submit button of the form,  is clicked will start <span style="text-decoration: underline;">the validation of the form,</span> this is important try always to validate your forms, expecially for the <strong>breakballs(usually called spammer&#8230;)</strong>, so the first part of the script validate the form and if on of the input value is under 0 this will stop the script and return an error like in this image</p>
<p><a href="http://lastwebdesigner.com/wp-content/uploads/2009/06/validation.jpg" rel="lightbox[197]"><img class="alignnone size-full wp-image-198" title="validation" src="http://lastwebdesigner.com/wp-content/uploads/2009/06/validation.jpg" alt="validation How to send a mail with php ajax and jquery in facebook style" width="518" height="191" /></a></p>
<p>the text that appears is stored in the<strong> #response div</strong>, for this reason I said that is important and not only for this. <img src='http://lastwebdesigner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' title="How to send a mail with php ajax and jquery in facebook style" /> </p>
<blockquote><p><strong>var valid = &#8221;;<br />
var isr = &#8216; is required.&#8217;;<br />
var name = $(&#8220;#name&#8221;).val();<br />
var mail = $(&#8220;#mail&#8221;).val();<br />
var subject = $(&#8220;#subject&#8221;).val();<br />
var text = $(&#8220;#text&#8221;).val();<br />
if (name.length&lt;1) {<br />
valid += &#8216;&lt;br /&gt;Name&#8217;+isr;<br />
}<br />
if (!mail.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i)) {<br />
valid += &#8216;&lt;br /&gt;A valid Email&#8217;+isr;<br />
}<br />
if (subject.length&lt;1) {<br />
valid += &#8216;&lt;br /&gt;Subject&#8217;+isr;<br />
}<br />
if (text.length&lt;1) {<br />
valid += &#8216;&lt;br /&gt;Text&#8217;+isr;<br />
}<br />
</strong></p></blockquote>
<p>To validate the mail, I&#8217;ve used a <strong>regular expression</strong>( <a title="Juan carlos Barreiro" href="http://enterprisedreams.net/">thanks to Juan Carlos</a> <img src='http://lastwebdesigner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' title="How to send a mail with php ajax and jquery in facebook style" />  )</p>
<blockquote><p><strong>if (!mail.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i))</strong></p></blockquote>
<p>if you try to write <strong>2 mail addres</strong>, this will not works, or if you use white space in the mail field the validation will stop the script. You can try simply leaving white the various fields to understand how it works. All of the error in the validation will appears in the <strong>response div</strong>, that will appear with a<strong> fadeIn effect.</strong></p>
<blockquote><p><strong>if (valid!=&#8221;) {<br />
$(&#8220;#response&#8221;).fadeIn(&#8220;slow&#8221;);<br />
$(&#8220;#response&#8221;).html(&#8220;Error:&#8221;+valid);<br />
}</strong></p></blockquote>
<p>The second part of the script is for create the <span style="text-decoration: underline;"><strong>datastr</strong></span> variable, that will store the value from the form and send in the <strong><span style="text-decoration: underline;">ajax request</span></strong>, and make appear again the <strong>#response div</strong>, yes how I said is important ejejeje, like the <strong>facebook</strong> style, that say that the message is sending.</p>
<blockquote><p><strong>else {<br />
var datastr =&#8217;name=&#8217; + name + &#8216;&amp;mail=&#8217; + mail + &#8216;&amp;subject=&#8217; + subject + &#8216;&amp;text=&#8217; + text;<br />
$(&#8220;#response&#8221;).css(&#8220;display&#8221;, &#8220;block&#8221;);<br />
$(&#8220;#response&#8221;).html(&#8220;Sending message &#8230;. &#8220;);<br />
$(&#8220;#response&#8221;).fadeIn(&#8220;slow&#8221;);<br />
setTimeout(&#8220;send(&#8216;&#8221;+datastr+&#8221;&#8216;)&#8221;,2000);<br />
}</strong></p></blockquote>
<p>In the final  part I&#8217;ve used a <strong>&#8220;return false</strong>&#8220;, so when you click on the submit button this doesn&#8217;t do nothing, well it seems that the button doesn&#8217;t do nothing, but the reason ts that the rest of the work is done by ajax and the function send :</p>
<blockquote><p><strong>function send(datastr){<br />
$.ajax({<br />
type: &#8220;POST&#8221;,<br />
url: &#8220;mail.php&#8221;,<br />
data: datastr,<br />
cache: false,<br />
success: function(html){<br />
$(&#8220;#response&#8221;).fadeIn(&#8220;slow&#8221;);<br />
$(&#8220;#response&#8221;).html(html);<br />
setTimeout(&#8216;$(&#8220;#response&#8221;).fadeOut(&#8220;slow&#8221;)&#8217;,4000);<br />
}<br />
});<br />
}</strong></p></blockquote>
<p>This is the &#8220;<strong>core</strong>&#8221; of the script, this will call th<a title="ajax" href="http://docs.jquery.com/Ajax" target="_blank">e</a><strong><a title="ajax" href="http://docs.jquery.com/Ajax" target="_blank"> $.ajax function of Jquery</a>,</strong> give it the parameters and call the <strong>mail.php</strong> file, finally get the response of the <strong>mail.php</strong>, and return this in the response div, and after<strong> 4 seconds the text fade out</strong>. <img src='http://lastwebdesigner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' title="How to send a mail with php ajax and jquery in facebook style" /> </p>
<p>This script is inspired ,how I said, from <strong>facebook message system</strong> and it works at the same way, you can use on your own and change or modify the source code.</p>
<blockquote><p><a class="demo" title="send a mail with php ajax and jquery" href="http://lastwebdesigner.com/tests/mail-jquery-php-ajax/"><strong>Here is the demo of the script </strong></a></p></blockquote>
<p><a class="download" title="download the full script" href="http://www.box.net/shared/kklgtosti5"><strong>Here you can download directly the script.</strong></a><br />
I hope is useful , you can use the comments and let me know what do you thing.</p>
<p>If you know something to improve the script, let me know pls.</p>
<p>Bye !!<br />
<h3 class="related-title">This posts may be interesting too</h3>
<ul class="related_post">
<li><a href="http://lastwebdesigner.com/javascript/detect-the-user-browser-with-javascript.html" title="Detect the user&#8217;s browser with javascript">Detect the user&#8217;s browser with javascript</a></li>
<li><a href="http://lastwebdesigner.com/php/php-beginner-guide-the-comments.html" title="Php Beginner guide : The comments">Php Beginner guide : The comments</a></li>
<li><a href="http://lastwebdesigner.com/jquery/simple-animated-menu-with-jquery.html" title="Simple animated menu with jquery">Simple animated menu with jquery</a></li>
<li><a href="http://lastwebdesigner.com/php/php-beginner-guide-introduction-to-php.html" title="php beginner guide: introduction to php">php beginner guide: introduction to php</a></li>
<li><a href="http://lastwebdesigner.com/photoshop/text-reflection-with-photoshop.html" title="Text reflection with photoshop">Text reflection with photoshop</a></li>
<li><a href="http://lastwebdesigner.com/photoshop/create-a-badge-20-with-photoshop.html" title="Create a badge 2.0 with Photoshop">Create a badge 2.0 with Photoshop</a></li>
<li><a href="http://lastwebdesigner.com/photoshop/create-a-fire-text-with-photoshop.html" title="Create a fire text with Photoshop">Create a fire text with Photoshop</a></li>
</ul>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://lastwebdesigner.com/jquery/how-to-send-a-mail-with-php-ajax-and-jquery-in-facebook-style.html/feed</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
		<item>
		<title>Php Beginner guide : The comments</title>
		<link>http://lastwebdesigner.com/php/php-beginner-guide-the-comments.html</link>
		<comments>http://lastwebdesigner.com/php/php-beginner-guide-the-comments.html#comments</comments>
		<pubDate>Sat, 13 Jun 2009 14:18:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PhP]]></category>
		<category><![CDATA[beginner guide]]></category>
		<category><![CDATA[comments php]]></category>
		<category><![CDATA[guide php]]></category>

		<guid isPermaLink="false">http://lastwebdesigner.com/?p=192</guid>
		<description><![CDATA[The comments in php are a really important phase of the programming, because they will help you, or other programmer, when you&#8217;ll come back to write on the same code after a long time. An important thing to know is  that their use does not weigh the execution of the script (the PHP interpreter jumps [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>The <strong>comments in php</strong> are a really important phase of the programming, because they will help you, or other programmer, when you&#8217;ll come back to write on the same code after a long time.</p>
<p>An important thing to know is  that their use does not weigh the execution of the scrip<strong>t (the PHP interpreter </strong>jumps all parties recognizing that comment), or the transfer of the page to the browser (in fact the comments, as contained within the <a title="simple php guide for beginners" href="http://lastwebdesigner.com/category/php/beginner-guide"><strong>PHP</strong></a> code, are part of what is not sent to the browser).<span id="more-192"></span></p>
<p>In php we have the same comments use in the major programming languages, like c++ or python, here some examples :</p>
<blockquote><p><strong>&lt;?php </strong></p>
<p><strong>// comment style c++</strong></p>
<p><strong>?&gt;</strong></p></blockquote>
<blockquote><p><strong>&lt;?php</strong></p>
<p><strong># comment style python</strong></p>
<p><strong>?&gt;</strong></p></blockquote>
<p>This kind of <strong>comments</strong> are only on one line, when the <a title="guide php" href="http://lastwebdesigner.com/category/php/beginner-guide">PHP</a> interpreter found this comments jump this part and go directly to the source php code.</p>
<p>But we can also use comments on more than one lines, like this :</p>
<blockquote><p>&lt;?php</p>
<p>/* this is a comment</p>
<p>on multilines</p>
<p>*/</p>
<p>?&gt;</p></blockquote>
<p>Be sure that don&#8217;t make error when you write a comment, or this will affect your code.</p>
<blockquote><p><strong>&lt;?php </strong></p>
<p><strong>*/ this is a erroneus comment</strong></p>
<p><strong>*/</strong></p>
<p><strong>?&gt;</strong></p></blockquote>
<blockquote><p><strong>&lt;?php </strong></p>
<p><strong>/* this is the correct </strong></p>
<p><strong>way to comment on mutlilines</strong></p>
<p><strong>*/</strong></p>
<p><strong>?&gt;</strong></p></blockquote>
<p>Simply not? The next time i will start writing code for php, stay tuned!<br />
<h3 class="related-title">This posts may be interesting too</h3>
<ul class="related_post">
<li><a href="http://lastwebdesigner.com/jquery/how-to-send-a-mail-with-php-ajax-and-jquery-in-facebook-style.html" title="How to send a mail with php ajax and jquery in facebook style">How to send a mail with php ajax and jquery in facebook style</a></li>
<li><a href="http://lastwebdesigner.com/php/php-beginner-guide-introduction-to-php.html" title="php beginner guide: introduction to php">php beginner guide: introduction to php</a></li>
</ul>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://lastwebdesigner.com/php/php-beginner-guide-the-comments.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>php beginner guide: introduction to php</title>
		<link>http://lastwebdesigner.com/php/php-beginner-guide-introduction-to-php.html</link>
		<comments>http://lastwebdesigner.com/php/php-beginner-guide-introduction-to-php.html#comments</comments>
		<pubDate>Mon, 08 Jun 2009 10:09:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PhP]]></category>
		<category><![CDATA[beginner guide]]></category>
		<category><![CDATA[php guide]]></category>

		<guid isPermaLink="false">http://lastwebdesigner.com/?p=166</guid>
		<description><![CDATA[Well.. Here we are with this first chapter of a simple guide to php for beginner. Before start I think is good if you know something about the history of this script languages. Php was &#8220;born&#8221; in 1994 from Rasmus Lerdor, was composed of a set of macro whose task was to simplify the websites [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Well.. Here we are with this<strong> first chapter </strong>of a<strong> simple guide to php for beginner. </strong>Before start I think is good if you know something about the history of this script languages.<br />
Php was &#8220;born&#8221; in <strong>1994</strong> from <strong>Rasmus Lerdor</strong>, was composed of a set of macro whose task was to simplify th<strong>e websites management.</strong></p>
<p>The first step was the expansion of the macro with a packet called<strong> form interpreter</strong>. From here Php was in continue expansion and now is a one of the most used langues in the websites with a  bigger community  and over 10.000.000 of server that support php now. The reason of this big expansion are lots. <strong>Php</strong> is open source, is free, is simple and works perfectly with <strong>Apache</strong>, the most used web server in the world.<span id="more-166"></span></p>
<p>The important thing that you must remember about <strong>php</strong>, is that this language is <span style="text-decoration: underline;">server side.</span></p>
<p>What it means that php is a  server side languages?</p>
<p>It means that the language is <span style="text-decoration: underline;">interpreted from the server,</span> namely the server, through an <strong>interpreter</strong>, received the php code from the page and returns the <span style="text-decoration: underline;">html code.</span> indeed if you look at the source <span style="text-decoration: underline;"><strong>code of a php page you will never see php code,</strong></span> but only the html that the server interpreter returns.</p>
<p>This is the difference between <strong>php</strong> and <strong>javascript</strong>, for example, that is a<strong> client side language</strong>, so it depend on the browser user and not from the server.</p>
<p><strong>Php</strong> is perfect to work with database like <strong>mysql</strong>, to create<strong> e-commerce sites, administration systems</strong> and other more, one of a great example is <strong>WordPress</strong>, the CMS blogging platform that runs this website.</p>
<p>How to recognize php code? Here an example:</p>
<blockquote><p><strong>&lt;?php echo &#8220;Hello World!&#8221;; ?&gt;</strong></p></blockquote>
<p>This is an example, if you will try this code the page will results this :</p>
<blockquote><p><strong>Hello World!.</strong></p></blockquote>
<p>A php tag start always with the &#8220;<strong>&lt;?php</strong>&#8221; and end with &#8220;<strong>?&gt;</strong>&#8221; you can omit the <strong>&#8220;php&#8221;</strong> in the start tag.</p>
<p>Other important thing of the <strong>php syntax</strong> is the &#8220;<strong>;</strong>&#8221; at the end, this means the end of the instruction(never forget, is important!) , this was inherited from the most used languages, like <strong>c, java</strong> and similar.</p>
<p>Finally the most simple instruction in php, the &#8220;<strong>echo</strong>&#8221; that say to the server this : <span style="text-decoration: underline;"><strong>write what is wrote between the &#8221; &#8220;.</strong></span></p>
<p>How I said if you will look at the source code you don&#8217;t see the php code, but only the html that the server returns.<br />
Well for the moment I think is good, now you know what is php, how it works and how to start writing code, I think is a good begin.</p>
<p>This is onl<strong>y the first chapter of this php guide for beginner</strong>, so &#8230; stay tuned for the other chapters.</p>
<p>Hasta Luego!<br />
<h3 class="related-title">This posts may be interesting too</h3>
<ul class="related_post">
<li><a href="http://lastwebdesigner.com/jquery/how-to-send-a-mail-with-php-ajax-and-jquery-in-facebook-style.html" title="How to send a mail with php ajax and jquery in facebook style">How to send a mail with php ajax and jquery in facebook style</a></li>
<li><a href="http://lastwebdesigner.com/php/php-beginner-guide-the-comments.html" title="Php Beginner guide : The comments">Php Beginner guide : The comments</a></li>
</ul>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://lastwebdesigner.com/php/php-beginner-guide-introduction-to-php.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
