<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>PHP Programming</title>
	<atom:link href="http://phpprogramming.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpprogramming.wordpress.com</link>
	<description></description>
	<lastBuildDate>Sat, 28 Jan 2012 07:31:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='phpprogramming.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>PHP Programming</title>
		<link>http://phpprogramming.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://phpprogramming.wordpress.com/osd.xml" title="PHP Programming" />
	<atom:link rel='hub' href='http://phpprogramming.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Passing Array Using Html Form Hidden Element</title>
		<link>http://phpprogramming.wordpress.com/2007/05/06/php-passing-array-using-hidden-form-element/</link>
		<comments>http://phpprogramming.wordpress.com/2007/05/06/php-passing-array-using-hidden-form-element/#comments</comments>
		<pubDate>Sun, 06 May 2007 17:43:34 +0000</pubDate>
		<dc:creator>V.HPatel</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://phpprogramming.wordpress.com/2007/05/06/php-passing-array-using-hidden-form-element/</guid>
		<description><![CDATA[Html form hidden element is used to pass information which is not visible to the user but used internaly by underlying scripts. For example the status of the process or step of multi step form submission. PHP array is an important language structure used in manipulation of multiple values associated with single object. Sometimes it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=13&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="justify"><a title="Html form hidden element" href="http://phpnmysql.blogspot.com/2007/04/php-beginners-using-html-form-elements.html">Html form hidden element</a> is used to pass information which is not visible to the user but used internaly by underlying scripts. For example the status of the process or step of multi step form submission. PHP array is an important language structure used in manipulation of multiple values associated with single object. Sometimes it is required to pass these values accross the pages between browser and the server. Following method can be used to pass PHP Arrays using html form hidden elements.</p>
<h4>Using individual array element</h4>
<p align="justify">This method uses seperate hidden element for each element in array. This can be done by following method.</p>
<p><em>foreach ($my_array as $key =&gt; $value)<br />
{<br />
 echo &#8216;&lt;input type=hidden name=&#8221;my_array[]&#8221; value=&#8221;&#8216;.htmlspecialchars($value).&#8217;&#8221;&gt;&#8217;;<br />
}<br />
</em><br />
This will generate an array in html form. And when submitted can be accessed by form handling PHP script using following code.<br />
<em>$my_array = $_POST['my_array'];</em></p>
<h4>Combining all array elements in one value to hidden element</h4>
<p align="justify">In this method all elements in an array are combined in single value using implode() PHP function. implode() will return a string combining all the array elements in the same order, seperated by given string. Then this combined value can be passed in html form hidden element. See below.<br />
<em>$single_value = implode(&#8220;,&#8221;, $my_array);<br />
echo &#8216;&lt;input type=hidden name=&#8221;single_value&#8221; value=&#8221;&#8216;.htmlspecialchars($single_value).&#8217;&#8221;&gt;&#8217;;<br />
</em><br />
And when submitted the array can be retreived using explode() PHP function. explode() will return an array by spliting the string using the given seperator. See code below.<br />
<em>$my_array = explode(&#8220;,&#8221;,$_POST['single_value']);</em></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpprogramming.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpprogramming.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpprogramming.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpprogramming.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpprogramming.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpprogramming.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phpprogramming.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phpprogramming.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phpprogramming.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phpprogramming.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpprogramming.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpprogramming.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpprogramming.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpprogramming.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpprogramming.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpprogramming.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=13&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phpprogramming.wordpress.com/2007/05/06/php-passing-array-using-hidden-form-element/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29b12765fddabe438d7e2f02833c18a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">V.HPatel</media:title>
		</media:content>
	</item>
		<item>
		<title>PHP Cookies Tutorial And PHP Cookies Examples</title>
		<link>http://phpprogramming.wordpress.com/2007/03/06/php-cookies-tutorial-and-examples/</link>
		<comments>http://phpprogramming.wordpress.com/2007/03/06/php-cookies-tutorial-and-examples/#comments</comments>
		<pubDate>Tue, 06 Mar 2007 12:36:51 +0000</pubDate>
		<dc:creator>V.HPatel</dc:creator>
				<category><![CDATA[tutorials]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://phpprogramming.wordpress.com/2007/03/06/php-cookies-tutorial-and-examples/</guid>
		<description><![CDATA[In the course of developing highly interactive web sites it is necessary to deal with large amount of data flow between client browswer and web server. It is quite cumbersome handling such large amount of data using hidden fiels in HTML forms. This problem can be overcomed by using HTTP cookies. HTTP cookies are the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=11&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="justify">In the course of developing highly interactive web sites it is necessary to deal with large amount of data flow between client browswer and web server. It is quite cumbersome handling such large amount of data using hidden fiels in HTML forms. This problem can be overcomed by using HTTP cookies. HTTP cookies are the bunch of data/text sent by the server to the web browswer. Web browser store this data locally and send back to the server each time it accesses the server before it expires. Note that now a days Most browsers allow users choice to accept cookies or not, sometime rejection causes web site to not work properly.</p>
<p align="justify"><strong>setcookie() function</strong>.<br />
This function in <a href="http://phpnmysql.blogspot.com/2007/04/php-beginners-php-language-elements.html" title="PHP Language Elements">PHP Language</a> is used to work with HTTP cookies. setcookie() defines a cookie to be sent along with the rest of the HTTP headers. This must be called before sending any output to the browser because cookies are part of the HTTP header. On successful it will return TRUE. But this does not mean that client browser has ccepted cookie.</p>
<p align="justify"><strong>setcookie() syntax.</strong><br />
<em>bool setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]])</em></p>
<ul>
<li><strong>name</strong>: This argument sets the name of the cookie.<br />
for example <em>setcookie(&#8216;mycookie&#8217;, &#8230;)</em> will set mycookie and is called $_COOKIE['mycookie'] at server side.</li>
<li><strong>value</strong>: This will set the value of the cookie. Since this values is stored on the client browser extra care must be taken that it does not store some secure information e.g passwords. The values is accessed by $_COOKIE['mycookie'] at the web server.</li>
<li><strong>expire</strong>: Sets the expire time of cookie. It is Unix timestamp so generally it is used with time() function. For example time()+60*30. This will set the cookie to expire in 30 minutes. If not set the cookie is not persistent and will expire when the browser closes.</li>
<li><strong>path</strong>: The path of cookies are used to organise cookies based on the path at web server. If set to &#8216;/&#8217; this cookie is availabe to all directories. If set to &#8216;/dir1/&#8217; this cookie is availabe to dir1 only and all sub directories of /dir1 i.e /dir1/sub1. Note that the default value is the current directory so if the current directory is &#8216;/dir1/&#8217; and you want to set it for all directories it must be &#8216;/&#8217;</li>
<li><strong>domain</strong>: This argument will decide in which domain cookie is accesible. Value &#8216;www.mydomin.com&#8217;<br />
makes it accesible to www sub-domain only. To make it accessible to all subdomains of mydomin.com a value<br />
&#8216;.mydomin.com&#8217; must be set.</li>
<li><strong>secure</strong>: Value 1 indicates the cookie must be used on secure (https) connection. Default value is 0.</li>
</ul>
<p align="justify"><strong>setcookie() Examples.<br />
</strong><em>setcookie(&#8216;mycookie&#8217;, &#8216;Test mycookie&#8217;);</em> This will set &#8216;mycookie&#8217; with value &#8216;Test mycookie&#8217; will expire when browser closes.<br />
<em>setcookie(&#8216;mycookie&#8217;, &#8216;Test mycookie&#8217;, time()+3600*24);</em> This will expire in 1 day.<br />
<em>setcookie(&#8216;mycookie&#8217;, &#8216;Test mycookie&#8217;, time()+3600*24, &#8220;/dir1/&#8221;); </em>Available to /dir1 directory and all subdirectories under it.</p>
<p align="justify"><strong>Accessing cookie values at server.<br />
</strong>At server in <a href="http://phpprogramming.wordpress.com/2007/01/23/php-basics/">PHP script</a>, cookies sent from the client browser will be turned into <a href="http://phpnmysql.blogspot.com/2007/04/php-beginners-php-language-elements.html" title="PHP Variables">PHP variables</a>. After PHP 4.1.0 the global array variable $_COOKIE is set for cookies from the client. $HTTP_COOKIE_VARS is also present which is availabe before PHP 4.1.0. See example below.<br />
<em>echo $_COOKIE["mycookie"];</em> This will output &#8220;Test mycookie&#8221; in our example.</p>
<p align="justify"><strong>Testing cookie.<br />
</strong>On successful return of setcookie() does not mean that client browser has accepted the cookie or cookie is set successfully. It must be checked on next loading of the page if a cookie was successfully set or not. This can be done by using <a href="http://phpnmysql.blogspot.com/2007/04/php-beginners-php-language-elements.html" title="PHP function">PHP function</a> print_r($_COOKIE) function. This will show weather the cookie is set or not.</p>
<p align="justify"><strong>Deleting a cookie.<br />
</strong>Cookies can be deleted by setting its value to &#8220;&#8221; and all other parameters must be the same as they were set at the time of sending the cookie. We must ensure that the expiration date is in the past when deleting the cookie. See examples below.</p>
<p><em>setcookie (&#8220;mycookie&#8221;, &#8220;&#8221;, time() &#8211; 3600);<br />
setcookie (&#8220;mycookie&#8221;, &#8220;&#8221;, time() &#8211; 3600, &#8220;/dir1/&#8221;);</em></p>
<p align="justify"><strong>Multiple cookies.<br />
</strong>Multiple cookies can be set using following.<br />
<em>setcookie(&#8216;mycookie1&#8242;, &#8216;Test mycookie1&#8242;);<br />
setcookie(&#8216;mycookie2&#8242;, &#8216;Test mycookie2&#8242;);<br />
setcookie(&#8216;mycookie3&#8242;, &#8216;Test mycookie3&#8242;);<br />
setcookie(&#8216;mycookie4&#8242;, &#8216;Test mycookie4&#8242;);</em></p>
<p>And can be accessed by following.<br />
<em>echo $_COOKIE["mycookie1"];<br />
echo $_COOKIE["mycookie2"];<br />
echo $_COOKIE["mycookie3"];<br />
echo $_COOKIE["mycookie4"];</em></p>
<p align="justify"><strong>Cookies Array.<br />
</strong>We can use PHP array in cookies. see example below<br />
<em>setcookie(&#8220;mycookie[0]&#8220;, &#8220;value1&#8243;);<br />
setcookie(&#8220;mycookie[1]&#8220;, &#8220;value2&#8243;);<br />
setcookie(&#8220;mycookie1['one']&#8220;, &#8220;value11&#8243;);<br />
setcookie(&#8220;mycookie1['five']&#8220;, &#8220;value15&#8243;);</em></p>
<p>This is similar of setting many cookies but the values are placed in the PHP array at the<br />
receing PHP script.</p>
<p><em>foreach ($_COOKIE['mycookie'] as $key =&gt; $value) {<br />
  echo &#8220;$key:$value &#8220;;<br />
  }<br />
</em>This will print 0:value1 1:value2<br />
And<br />
<em>foreach ($_COOKIE['mycookie1'] as $key =&gt; $value) {<br />
  echo &#8220;$key:$value &#8220;;<br />
  }<br />
</em>Will print print one:value11 five:value15</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpprogramming.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpprogramming.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpprogramming.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpprogramming.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpprogramming.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpprogramming.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phpprogramming.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phpprogramming.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phpprogramming.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phpprogramming.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpprogramming.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpprogramming.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpprogramming.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpprogramming.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpprogramming.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpprogramming.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=11&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phpprogramming.wordpress.com/2007/03/06/php-cookies-tutorial-and-examples/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29b12765fddabe438d7e2f02833c18a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">V.HPatel</media:title>
		</media:content>
	</item>
		<item>
		<title>PHP Arrays Tutorial and PHP Array Examples</title>
		<link>http://phpprogramming.wordpress.com/2007/02/25/php-arrays-tutorial-and-examples/</link>
		<comments>http://phpprogramming.wordpress.com/2007/02/25/php-arrays-tutorial-and-examples/#comments</comments>
		<pubDate>Sun, 25 Feb 2007 17:44:38 +0000</pubDate>
		<dc:creator>V.HPatel</dc:creator>
				<category><![CDATA[tutorials]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://phpprogramming.wordpress.com/2007/02/25/php-arrays-tutorial-and-examples/</guid>
		<description><![CDATA[An array in PHP is actually an ordered map. A map is a type that maps values to keys. This type is optimized in several ways, so you can use it as a real array, or a list (vector), hashtable (which is an implementation of a map), dictionary, collection, stack, queue and probably more. Because [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=9&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="justify">An array in PHP is actually an ordered map. A map is a type that maps values to keys. This type is optimized in several ways, so you can use it as a real array, or a list (vector), hashtable (which is an implementation of a map), dictionary, collection, stack, queue and probably more. Because you can have another PHP array as a value, you can also quite easily simulate trees.</p>
<p><strong>PHP Array Syntax: Create an Array</strong><br />
language-construct <strong>array()</strong> is used to create an array in PHP. See example below</p>
<p><em>array( [key =&gt;] value<br />
  , &#8230;<br />
  )<br />
</em><strong>key</strong>: key may be an integer or string<br />
<strong>value</strong>: A value can be of any PHP type</p>
<p><strong>Examples</strong><br />
<em>$arr = array(&#8220;foo&#8221; =&gt; &#8220;bar&#8221;, 12 =&gt; true);<br />
echo $arr["foo"]; this will print bar<br />
echo $arr[12]; this will print 1</em></p>
<p>if you provide the brackets with no key specified, then the maximum of the existing integer indices +1 is taken as key. see below</p>
<p><em>$arr = array(5 =&gt; 1, 12 =&gt; 2); This will create an array with 2 elements<br />
$arr[] = 56;     new key will be maximum key + 1 i.e $arr[13] = 56<br />
$arr["x"] = 42;  This adds a new element to the array with key &#8220;x&#8221;<br />
</em></p>
<p><em>array(5 =&gt; 43, 32, 56, &#8220;b&#8221; =&gt; 12); This array is the same as following.<br />
array(5 =&gt; 43, 6 =&gt; 32, 7 =&gt; 56, &#8220;b&#8221; =&gt; 12); </em></p>
<p align="justify"><strong>Handling arrays from html form inputs to php scripts</strong><br />
Following example will show we can use an array from html form inputs.</p>
<p>HTML form with array<br />
<em>&lt;input type=&#8221;checkbox&#8221; name=&#8221;selected_ids[]&#8221; value=&#8221;1&#8243;&gt;<br />
&lt;input type=&#8221;checkbox&#8221; name=&#8221;selected_ids[]&#8221; value=&#8221;2&#8243;&gt;<br />
&lt;input type=&#8221;checkbox&#8221; name=&#8221;selected_ids[]&#8221; value=&#8221;3&#8243;&gt;<br />
&lt;input type=&#8221;checkbox&#8221; name=&#8221;selected_ids[]&#8221; value=&#8221;11&#8243;&gt;<br />
&lt;input type=&#8221;checkbox&#8221; name=&#8221;selected_ids[]&#8221; value=&#8221;12&#8243;&gt;<br />
&lt;input type=&#8221;checkbox&#8221; name=&#8221;selected_ids[]&#8221; value=&#8221;13&#8243;&gt;<br />
</em></p>
<p align="justify">When we submit above form, it will generate $_POST['selected_ids'][] array to the form handling php script. This array holds all selected checkbox values from above html form. foreach() construct can be used to extract values from the array. Following code example will show how we can extract those values from the returning array.</p>
<p><em>foreach ($_POST['selected_ids'] as $key =&gt; $value) {<br />
    echo &#8220;Key: $key; Value: $value&lt;br&gt;&#8221;;<br />
}<br />
</em>for example if 1,2 and 12 is selected from the above html form then above code will print<br />
<em>Key: 0 Value: 1<br />
Key: 1 Value: 2<br />
Key: 2 Value: 12</em></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpprogramming.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpprogramming.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpprogramming.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpprogramming.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpprogramming.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpprogramming.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phpprogramming.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phpprogramming.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phpprogramming.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phpprogramming.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpprogramming.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpprogramming.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpprogramming.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpprogramming.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpprogramming.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpprogramming.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=9&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phpprogramming.wordpress.com/2007/02/25/php-arrays-tutorial-and-examples/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29b12765fddabe438d7e2f02833c18a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">V.HPatel</media:title>
		</media:content>
	</item>
		<item>
		<title>Using remote files in PHP</title>
		<link>http://phpprogramming.wordpress.com/2007/02/17/using-remote-files-in-php/</link>
		<comments>http://phpprogramming.wordpress.com/2007/02/17/using-remote-files-in-php/#comments</comments>
		<pubDate>Sat, 17 Feb 2007 17:18:40 +0000</pubDate>
		<dc:creator>V.HPatel</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://phpprogramming.wordpress.com/2007/02/17/using-remote-files-in-php/</guid>
		<description><![CDATA[As long as allow_url_fopen is enabled in php.ini, you can use HTTP and FTP URLs with most of the functions that take a filename as a parameter. In addition, URLs can be used with the include(), include_once(), require() and require_once() statements. In PHP 4.0.3 and older, in order to use URL wrappers, you were required [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=7&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="justify">As long as allow_url_fopen is enabled in php.ini, you can use HTTP and FTP URLs with most of the functions that take a filename as a parameter. In addition, URLs can be used with the include(), include_once(), require() and require_once() statements. In PHP 4.0.3 and older, in order to use URL wrappers, you were required to configure PHP using the configure option &#8211;enable-url-fopen-wrapper.</p>
<p align="justify"><strong>Getting the title of a remote page</strong><br />
For example, you can use code below to to open a file from a remote web server and extract title of the page.</p>
<p><em>&lt;?php<br />
$file = fopen (&#8220;http://www.example.com/&#8221;, &#8220;r&#8221;);<br />
if (!$file) {<br />
    echo &#8220;&lt;p&gt;Unable to open remote file.\n&#8221;;<br />
    exit;<br />
}<br />
while (!feof ($file)) {<br />
    $line = fgets ($file, 1024);<br />
    /* This only works if the title and its tags are on one line */<br />
    if (eregi (&#8220;&lt;title&gt;(.*)&lt;/title&gt;&#8221;, $line, $out)) {<br />
        $title = $out[1];<br />
        break;<br />
    }<br />
}<br />
fclose($file);<br />
?&gt; <br />
</em></p>
<p><strong>Reading the contents of a remote file</strong><br />
fread function can be used to read content of remote file. This is shown in example below. You should collect the data together in chunks as shown in the example below because reading will stop after a packet is available.</p>
<p><em>&lt;?php<br />
$handle = fopen(&#8220;http://www.example.com/&#8221;, &#8220;rb&#8221;);<br />
$contents = &#8221;;<br />
while (!feof($handle)) {<br />
  $contents .= fread($handle, 8192);<br />
}<br />
fclose($handle);<br />
?&gt; <br />
</em></p>
<p><strong>reading the contents of a file into array</strong><br />
file function returns the file in an array. Each element of the array corresponds to a line in the file, with the newline still attached. Each line in the resulting array will include the line ending, so you still need to use rtrim() if you do not want the line ending present.</p>
<p><em>&lt;?php<br />
// Get a file into an array.  In this example we&#8217;ll go through HTTP to get<br />
// the HTML source of a URL.<br />
$lines = file(&#8216;http://www.example.com/&#8217;);</em></p>
<p><em>// Loop through our array, show HTML source as HTML source; and line numbers too.<br />
foreach ($lines as $line_num =&gt; $line) {<br />
    echo &#8220;Line #&lt;b&gt;{$line_num}&lt;/b&gt; : &#8221; . htmlspecialchars($line) . &#8220;&lt;br /&gt;\n&#8221;;<br />
}<br />
?&gt;<br />
</em><strong><br />
reading the contents of a file into a string</strong><br />
file_get_contents() returns the file in a string. This is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance.</p>
<p>&lt;?php<br />
$content_string = file_get_contents(&#8216;www.example.com/products.html&#8217;);<br />
?&gt;</p>
<p><strong>Storing data on a remote server</strong><br />
You can also write to files on an FTP server (provided that you have connected as a user with the correct access rights). You can only create new files using this method; if you try to overwrite a file that already exists, the fopen() call will fail. You need to specify the username and password within the URL, such as &#8216;ftp://user:password@ftp.example.com/path/to/file&#8217;.</p>
<p><em>&lt;?php<br />
$file = fopen (&#8220;ftp://ftp.example.com/incoming/outputfile&#8221;, &#8220;w&#8221;);<br />
if (!$file) {<br />
    echo &#8220;&lt;p&gt;Unable to open remote file for writing.\n&#8221;;<br />
    exit;<br />
}<br />
/* Write the data here. */<br />
fwrite ($file, $_SERVER['HTTP_USER_AGENT'] . &#8220;\n&#8221;);<br />
fclose ($file);<br />
?&gt; <br />
</em></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpprogramming.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpprogramming.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpprogramming.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpprogramming.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpprogramming.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpprogramming.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phpprogramming.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phpprogramming.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phpprogramming.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phpprogramming.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpprogramming.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpprogramming.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpprogramming.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpprogramming.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpprogramming.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpprogramming.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=7&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phpprogramming.wordpress.com/2007/02/17/using-remote-files-in-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29b12765fddabe438d7e2f02833c18a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">V.HPatel</media:title>
		</media:content>
	</item>
		<item>
		<title>PHP File Upload</title>
		<link>http://phpprogramming.wordpress.com/2007/02/15/php-file-upload/</link>
		<comments>http://phpprogramming.wordpress.com/2007/02/15/php-file-upload/#comments</comments>
		<pubDate>Thu, 15 Feb 2007 16:00:50 +0000</pubDate>
		<dc:creator>V.HPatel</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://phpprogramming.wordpress.com/2007/02/15/php-file-upload/</guid>
		<description><![CDATA[PHP can be used to receive files from any RFC-1867 compliant browser. This can be used to upload both text and binary files from browsers. See the file upload html form below: &#60;form enctype=&#8221;multipart/form-data&#8221; action=&#8221;handle_upload.php&#8221; method=&#8221;post&#8221;&#62;  &#60;input type=&#8221;hidden&#8221; name=&#8221;MAX_FILE_SIZE&#8221; value=&#8221;30000&#8243;&#62;  Select File: &#60;input name=&#8221;myfile&#8221; type=&#8221;file&#8221;&#62;  &#60;input type=&#8221;submit&#8221; value=&#8221;Upload&#8221;&#62; &#60;/form&#62; MAX_FILE_SIZE hidden field restrict the maximum [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=6&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="justify">PHP can be used to receive files from any RFC-1867 compliant browser. This can be used to upload both text and binary files from browsers. See the file upload html form below:</p>
<p align="justify"><em>&lt;form <strong>enctype</strong>=&#8221;multipart/form-data&#8221; action=&#8221;handle_upload.php&#8221; method=&#8221;post&#8221;&gt;<br />
 &lt;input type=&#8221;hidden&#8221; name=&#8221;<strong>MAX_FILE_SIZE</strong>&#8221; value=&#8221;30000&#8243;&gt;<br />
 Select File: &lt;input name=&#8221;myfile&#8221; <strong>type=&#8221;file&#8221;</strong>&gt;<br />
 &lt;input type=&#8221;submit&#8221; value=&#8221;Upload&#8221;&gt;<br />
&lt;/form&gt;<br />
</em></p>
<ul>
<li>MAX_FILE_SIZE hidden field restrict the maximum filesize accepted in bytes and must precede the file input field</li>
<li>enctype=&#8221;multipart/form-data&#8221; is used to handle file uploads and file will be uploaded as MIME data streams. Otherwise the file upload will not work.</li>
</ul>
<p align="justify">The Variables, in PHP script which receives file upload, differs depending on the PHP version and configuration. The $_FILES exists as of PHP 4.1.0 The $HTTP_POST_FILES array has existed since PHP 4.0.0. These arrays hold uploaded file information. Using $_FILES is preferred.<br />
The contents of $_FILES from above script is as follows.</p>
<ul>
<li><strong>$_FILES['myfile']['name'] </strong>The original name of the file on the client machine.</li>
<li><strong>$_FILES['myfile']['type'] </strong>The mime type of the file, if the browser provided this information. An example would be &#8220;image/gif&#8221;.</li>
<li><strong>$_FILES['myfile']['size'] </strong>The size, in bytes, of the uploaded file.</li>
<li><strong>$_FILES['myfile']['tmp_name'] </strong>The temporary filename of the file in which the uploaded file was stored on the server.</li>
<li><strong>$_FILES['myfile']['error'] </strong>Since PHP 4.2.0, PHP returns an appropriate following error code along with the file array<br />
UPLOAD_ERR_OK &#8211; Value: 0; There is no error, the file uploaded with success.<br />
UPLOAD_ERR_INI_SIZE Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.<br />
UPLOAD_ERR_FORM_SIZE Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.<br />
UPLOAD_ERR_PARTIAL Value: 3; The uploaded file was only partially uploaded.<br />
UPLOAD_ERR_NO_FILE Value: 4; No file was uploaded.</li>
</ul>
<p align="justify">Uploaded Files will by default be stored in the server&#8217;s default temporary directory. Variable $_FILES['myfile']['tmp_name'] will hold the info about where it is stored. The move_uploaded_file function needs to be used to store the uploaded file to the correct location. See the code below:</p>
<p align="justify"><em>$uploaddir = &#8220;uploads/&#8221;;<br />
$uploadfile = $uploaddir . basename( $_FILES['myfile']['name']); </em></p>
<p align="justify"><em>if(move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile))<br />
{<br />
  echo &#8220;The file has been uploaded successfully&#8221;;<br />
}<br />
else<br />
{<br />
  echo &#8220;There was an error uploading the file&#8221;;<br />
}<br />
</em></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpprogramming.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpprogramming.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpprogramming.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpprogramming.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpprogramming.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpprogramming.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phpprogramming.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phpprogramming.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phpprogramming.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phpprogramming.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpprogramming.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpprogramming.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpprogramming.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpprogramming.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpprogramming.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpprogramming.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=6&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phpprogramming.wordpress.com/2007/02/15/php-file-upload/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29b12765fddabe438d7e2f02833c18a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">V.HPatel</media:title>
		</media:content>
	</item>
		<item>
		<title>PHP HTML basic tips and tricks</title>
		<link>http://phpprogramming.wordpress.com/2007/01/30/php-html-basic-tips-and-tricks/</link>
		<comments>http://phpprogramming.wordpress.com/2007/01/30/php-html-basic-tips-and-tricks/#comments</comments>
		<pubDate>Tue, 30 Jan 2007 13:56:44 +0000</pubDate>
		<dc:creator>V.HPatel</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://phpprogramming.wordpress.com/2007/01/30/php-html-basic-tips-and-tricks/</guid>
		<description><![CDATA[PHP is an HTML-embedded scripting language. The goal of the language is to allow web developers to write dynamically generated pages quickly. In the course of web development of using PHP PHP and HTML interact a lot. PHP can generate HTML, and HTML can pass information to PHP. Encoding/decoding when passing a data through a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=5&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>PHP is an HTML-embedded scripting language. The goal of the language is to allow web developers to write dynamically generated pages quickly. In the course of web development of using PHP PHP and HTML interact a lot. PHP can generate HTML, and HTML can pass information to PHP.</p>
<p align="justify"><strong>Encoding/decoding when passing a data through a form or URL</strong><br />
Certain characters, for example &#8216;&amp;&#8217;, have special significance in HTML, and should be represented by HTML entities if they are to preserve their meanings. There are several stages for which encoding is important. Assuming that you have a string $data, which contains the string you want to pass on in a non-encoded way, these are the relevant stages.</p>
<p>Passing a value through HTML FORM you must include it in double quotes, and htmlspecialchars() the whole value. For exampe see the code below</p>
<p class="example"><em>&lt;?php echo &#8220;&lt;input name=&#8217;data&#8217; type=&#8217;hidden&#8217; value=&#8217;<strong>&#8221; . htmlspecialchars($data) . &#8220;</strong>&#8216;&gt;&#8221;; ?&gt;</em></p>
<p>While passing a value through URL you must encode it with urlencode(). It will convert all non-alphanumeric characters except -_. with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs. See example below.<br />
<em>&lt;?php echo &#8220;&lt;a href=&#8217;&#8221; . htmlspecialchars(&#8220;/nextpage.php?stage=23&amp;data=&#8221; .<strong>urlencode($data)</strong> . &#8220;&#8216;&gt;\n&#8221;; ?&gt;<br />
</em></p>
<p align="justify"><strong>Creating a PHP arrays in a HTML form</strong></p>
<p>To get your FORM result sent as an array to your PHP script you name the INPUT, SELECT, TEXTAREA elements like this:<br />
<em>&lt;input name=&#8221;<strong>MyArray[]</strong>&#8220;&gt;<br />
&lt;input name=&#8221;MyArray[]&#8220;&gt;<br />
&lt;input name=&#8221;MyArray[]&#8220;&gt;<br />
&lt;input name=&#8221;MyArray[]&#8220;&gt;</em></p>
<p>If you do not specify the keys, the array gets filled in the order the elements appear in the form. Above example will contain keys 0, 1, 2 and 3. Notice the square brackets after the variable name, that&#8217;s what makes it an array. You can group the elements into different arrays by assigning the same name to different elements:<br />
<em>&lt;input name=&#8221;<strong>MyArray[]</strong>&#8220;&gt;<br />
&lt;input name=&#8221;MyArray[]&#8220;&gt;<br />
&lt;input name=&#8221;<strong>MyOtherArray[]</strong>&#8220;&gt;<br />
&lt;input name=&#8221;MyOtherArray[]&#8220;&gt;<br />
</em>This produces two arrays, MyArray and MyOtherArray, that gets sent to the PHP script. It&#8217;s also possible to assign specific keys to your arrays:<br />
<em>&lt;input name=&#8221;AnotherArray[]&#8220;&gt;<br />
&lt;input name=&#8221;AnotherArray[]&#8220;&gt;<br />
&lt;input name=&#8221;<strong>AnotherArray[email]</strong>&#8220;&gt;<br />
&lt;input name=&#8221;AnotherArray[phone]&#8220;&gt;</em><br />
The AnotherArray array will now contain the keys 0, 1, email and phone.</p>
<p><strong>Getting results from a select multiple HTML tag.</strong><br />
The select multiple tag in an HTML construct allows users to select multiple items from a list. These items are then passed to the action handler for the form. The problem is that they are all passed with the same widget name. I.e.<br />
<em>&lt;select name=&#8221;var&#8221; <strong>multiple=&#8221;yes&#8221;</strong>&gt;<br />
</em>Each selected option will arrive at the action handler as var=option1, var=option2, var=option3. Each option will overwrite the contents of the previous $var variable. The solution is to use PHP&#8217;s &#8220;array from form element&#8221; feature. The following should be used:<br />
<em>&lt;select name=&#8221;<strong>var[]</strong>&#8221; multiple=&#8221;yes&#8221;&gt;<br />
</em>Now first item becomes $var[0], the next $var[1], etc.</p>
<p align="justify"><strong>Passing a variable from Javascript to PHP<br />
</strong>Since Javascript is a client-side technology, and PHP is a server-side technology, the two languages cannot directly share variables. It is, however, possible to pass variables between the two. One way of accomplishing this is to generate Javascript code with PHP, and have the browser refresh itself, passing specific variables back to the PHP script. The example below shows precisely how to do this &#8212; it allows PHP code to capture screen height and width, something that is normally only possible on the client side.<br />
<em>&lt;?php<br />
if (isset($_GET['width']) AND isset($_GET['height'])) {<br />
  // output the geometry variables<br />
  echo &#8220;Screen width is: &#8220;. $_GET['width'] .&#8221;&lt;br /&gt;\n&#8221;;<br />
  echo &#8220;Screen height is: &#8220;. $_GET['height'] .&#8221;&lt;br /&gt;\n&#8221;;<br />
} else {<br />
  // pass the geometry variables<br />
  // (preserve the original query string<br />
  //   &#8212; post variables will need to handled differently)</em></p>
<p align="justify"><em>  echo &#8220;&lt;script language=&#8217;javascript&#8217;&gt;\n&#8221;;<br />
  echo &#8220;  location.href=\&#8221;${_SERVER['SCRIPT_NAME']}?${_SERVER['QUERY_STRING']}&#8221;<br />
            . <strong>&#8220;&amp;width=\&#8221; + screen.width + \&#8221;&amp;height=\&#8221; + screen.height;\n&#8221;;</strong><br />
  echo &#8220;&lt;/script&gt;\n&#8221;;<br />
  exit();<br />
}<br />
?&gt; <br />
</em></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpprogramming.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpprogramming.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpprogramming.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpprogramming.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpprogramming.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpprogramming.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phpprogramming.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phpprogramming.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phpprogramming.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phpprogramming.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpprogramming.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpprogramming.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpprogramming.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpprogramming.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpprogramming.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpprogramming.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=5&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phpprogramming.wordpress.com/2007/01/30/php-html-basic-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29b12765fddabe438d7e2f02833c18a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">V.HPatel</media:title>
		</media:content>
	</item>
		<item>
		<title>HTML Form Elements Values usage Examples in PHP</title>
		<link>http://phpprogramming.wordpress.com/2007/01/28/html-form-elements-values-usage-examples-in-php/</link>
		<comments>http://phpprogramming.wordpress.com/2007/01/28/html-form-elements-values-usage-examples-in-php/#comments</comments>
		<pubDate>Sun, 28 Jan 2007 18:12:58 +0000</pubDate>
		<dc:creator>V.HPatel</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://phpprogramming.wordpress.com/2007/03/19/html-form-elements-values-usage-examples-in-php/</guid>
		<description><![CDATA[During the development of interactive web sites using PHP and HTML it is requiredto deal with data flow between user/browser and the server. This is achieved by using HTML forms and supporting HTML form elements. Following examples shows how these form elements can be used in HTML andPHP to allow interaction between user and the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=12&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="justify">During the development of interactive web sites using PHP and HTML it is requiredto deal with data flow between user/browser and the server. This is achieved by using HTML forms and supporting HTML form elements. Following examples shows how these form elements can be used in HTML andPHP to allow interaction between user and the server.</p>
<h4>Text input HTML form element</h4>
<p align="justify">This input form element can be used for a single lime text input from the user. For example user first name, user e-mail, phone numbers etc. The syntax in HTML form is as below</p>
<p><em>&lt;input type=&#8221;text&#8221; name=&#8221;username&#8221;&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;email&#8221;&gt;</em></p>
<p>This will display an input box in the browser and the values of this element canbe accessed at the form handling php script by following.<em><br />
&lt;?php echo &#8220;User Name:&#8221;.$_POST['username']; ?&gt;<br />
</em><br />
<strong>Password type</strong>. The defulat type of HTML input element is text. The special password type of input can be used as following<br />
<em>&lt;input type=&#8221;password&#8221; name=&#8221;password&#8221;&gt;</em></p>
<p>and can be accessed in PHP similar to above input element.<br />
<em>&lt;?php echo &#8220;The Password is:&#8221;.$_POST['password']; ?&gt;<br />
</em><br />
<strong>Hidden type</strong>. The hidden field is used to send information from browser to the server without having to input it. Typically this is used to send some logical data that has nothing to do with user but used at the server in PHP program logic. For example state, action, or passing the result to the other module etc. Please note that you encode the value using htmlspecialchars() function.<br />
<em>&lt;input type=&#8221;hidden&#8221; name=&#8221;action&#8221; value=&#8221;&lt;?php echo htmlspecialchars(&#8216;step2&#8242;); ?&gt;&#8221;&gt;</em></p>
<p>and the value of this field can be accessed in PHP by following.<br />
<em>&lt;?php echo &#8220;The Value of action is:&#8221;.$_POST['action']; ?&gt;</em></p>
<h4>Textarea multiline text HTML form element</h4>
<p align="justify">This form element can be used for a multi-line text input from the user. For example product description. The syntax is as below.</p>
<p><em>&lt;textarea name=&#8221;description&#8221; rows=&#8221;5&#8243; cols=&#8221;50&#8243;&gt;&lt;/textarea&gt;</em></p>
<p>This will display a multi-line input area in the browser and the size can be controlled using rows and cols tag. The text value input by user can be accessed in PHP by following<br />
<em><br />
&lt;?php echo &#8220;Product Description:&#8221;.$_POST['description']; ?&gt;<br />
</em></p>
<h4>Select (Pull Down menu) and Select multiple HTML form element</h4>
<p align="justify">This type of HTML form element is used to allow user to select from multiple choices. For example selecting a month or a day. The html syntax is as below.<br />
<em><br />
&lt;select name=&#8221;year&#8221;&gt;<br />
&lt;option value=&#8221;2004&#8243;&gt;2004&lt;/option&gt;<br />
&lt;option value=&#8221;2005&#8243;&gt;2005&lt;/option&gt;<br />
&lt;option value=&#8221;2006&#8243;&gt;2006&lt;/option&gt;<br />
&lt;option value=&#8221;2007&#8243;&gt;2007&lt;/option&gt;<br />
&lt;option value=&#8221;2008&#8243;&gt;2008&lt;/option&gt;<br />
&lt;/select&gt;<br />
</em><br />
The value of selected choice can be accessed in form handling PHP script as following<br />
<em>&lt;?php echo &#8220;Selected Year is:&#8221;.$_POST['year']; ?&gt;</em></p>
<p>The variation to this allows user to select multiple choices from the given options.<br />
This can be done by following select multiple syntax<br />
<em><br />
&lt;select multiple name=&#8221;colors[]&#8221; size=&#8221;4&#8243;&gt;<br />
&lt;option value=&#8221;Red&#8221;&gt;Red<br />
&lt;option value=&#8221;Yellow&#8221;&gt;Yellow<br />
&lt;option value=&#8221;Blue&#8221;&gt;Blue<br />
&lt;option value=&#8221;Green&#8221;&gt;Green<br />
&lt;option value=&#8221;White&#8221;&gt;White<br />
&lt;option value=&#8221;Black&#8221;&gt;Black<br />
&lt;/select&gt;<br />
</em><br />
The size tag can be used to control how many rows should be visible. And note the use of &#8216;[]&#8216; following the name of the select box. This will denote that it is an array and the choices can be accessed in form handling PHP script by following.<br />
<em><br />
&lt;?php<br />
foreach ($_POST['colors'] as $key =&gt; $value) {<br />
echo &#8220;Key: $key; Value: $value&lt;br&gt;&#8221;;<br />
}<br />
?&gt;<br />
</em>If Red and Green is selected then above code will print<br />
0: Red<br />
1: Green</p>
<h4>Radio button HTML form element</h4>
<p align="justify">Radio button in HTML form is an alternative method that allows user to select from given options. Unlike drop down menu this is used to create more visibilty in the input form.</p>
<p><em>&lt;input type=&#8221;radio&#8221; name=&#8221;colour&#8221; value=&#8221;Red&#8221;&gt;Red<br />
&lt;input type=&#8221;radio&#8221; name=&#8221;colour&#8221; value=&#8221;Orange&#8221;&gt;Orange<br />
&lt;input type=&#8221;radio&#8221; name=&#8221;colour&#8221; value=&#8221;Blue&#8221;&gt;Blue<br />
</em><br />
The value of the selection can be accessed in PHP as following<br />
<em>&lt;?php echo &#8220;Selected Color is:&#8221;.$_POST['colour']; ?&gt;</em></p>
<h4>Check Box button HTML form element</h4>
<p>This is an alternative way of allowing user to select multiple choices from the given options. Following example show the use of Check Boxes in an HTML form</p>
<p><em>&lt;input type=&#8221;radio&#8221; name=&#8221;colour[]&#8221; value=&#8221;Red&#8221;&gt;Red<br />
&lt;input type=&#8221;radio&#8221; name=&#8221;colour[]&#8221; value=&#8221;Orange&#8221;&gt;Orange<br />
&lt;input type=&#8221;radio&#8221; name=&#8221;colour[]&#8221; value=&#8221;Blue&#8221;&gt;Blue<br />
&lt;input type=&#8221;radio&#8221; name=&#8221;colour[]&#8221; value=&#8221;Violet&#8221;&gt;Violet<br />
&lt;input type=&#8221;radio&#8221; name=&#8221;colour[]&#8221; value=&#8221;Black&#8221;&gt;Black<br />
</em><br />
Again here PHP array is used to access the selected choices from the user.<br />
<em>&lt;?php<br />
foreach ($_POST['colors'] as $key =&gt; $value) {<br />
echo &#8220;Key: $key; Value: $value&lt;br&gt;&#8221;;<br />
}<br />
?&gt;<br />
</em></p>
<p>If Red and Violet is selected then above code will display<br />
0: Red<br />
1: Violet</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpprogramming.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpprogramming.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpprogramming.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpprogramming.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpprogramming.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpprogramming.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phpprogramming.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phpprogramming.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phpprogramming.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phpprogramming.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpprogramming.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpprogramming.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpprogramming.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpprogramming.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpprogramming.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpprogramming.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=12&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phpprogramming.wordpress.com/2007/01/28/html-form-elements-values-usage-examples-in-php/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29b12765fddabe438d7e2f02833c18a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">V.HPatel</media:title>
		</media:content>
	</item>
		<item>
		<title>php connection status and connection handling</title>
		<link>http://phpprogramming.wordpress.com/2007/01/24/php-connection-status-and-connection-handling/</link>
		<comments>http://phpprogramming.wordpress.com/2007/01/24/php-connection-status-and-connection-handling/#comments</comments>
		<pubDate>Wed, 24 Jan 2007 16:42:06 +0000</pubDate>
		<dc:creator>V.HPatel</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://phpprogramming.wordpress.com/2007/03/04/php-connection-status-and-connection-handling/</guid>
		<description><![CDATA[There are three possible php connection states are maintained Internally. They are NORMAL, ABORTED and TIMEOUT. When the script is running normally the NORMAL php connection state is active. If the connection between client and server is stopped or disconnected it is in ABORTED state. If the max_execution_time of PHP script is expired the TIMEOUT [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=10&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="justify">There are three possible php connection states are maintained Internally. They are <em><strong>NORMAL, ABORTED and TIMEOUT</strong></em>. When the script is running normally the NORMAL php connection state is active. If the connection between client and server is stopped or disconnected it is in ABORTED state. If the max_execution_time of PHP script is expired the TIMEOUT state is active. The max_execution_time value is defined in the php.ini if it is not defined the default value is 30 seconds. There are functions availabe in PHP that can be used to control php connection status.</p>
<p align="justify"><strong>ignore_user_abort() function</strong> By default the php script is aborted when client stops or disconneted. Sometime it is required to always have the scripts run to completion. This function sets whether a client disconnect should cause a script to be aborted. It will return the previous setting and can be called without an argument to not change the current setting and only eturn the current setting. This behaviour can also be set via the ignore_user_abort php.ini directive as well as through the corresponding &#8220;php_value ignore_user_abort&#8221; Apache .conf directive.</p>
<p align="justify"><strong>register_shutdown_function() function.</strong> By default the php script is aborted when client stops or disconneted. One exception to this is if you have registered a shutdown function using register_shutdown_function(). This registered shutdown function will get called when the script is aborted by client disconnect. Note that this registered shutdown function will get called even if the script is terminating normally. For example such call <strong>register_shutdown_function(my_register_function) </strong>will register <strong>my_register_function()</strong> and will get called when underlying php script is terminating. Multiple calls to register_shutdown_function() can be made, and each will be called in the same order as they were registered. If you call exit() within one registered shutdown function, processing will stop completely and no other registered shutdown functions will be called. It is not possible to send any output to the browser in registered shutdown functions because they are called after the request has been completed including sending any output.</p>
<p align="justify"><strong>connection_aborted() function.</strong> This function returns TRUE if client disconnected. Typically this function is useful in registered shutdown functions to do something different in case of a client disconnect and php connection status is ABORTED.</p>
<p align="justify"><strong>Controling script execution time set_time_limit() function.</strong> The default timeout for any php script is 30 seconds. This can be changed using the max_execution_time php.ini directive or the corresponding &#8220;php_value max_execution_time&#8221; Apache .conf directive. This can also be controled run time by using set_time_limit() function. This function sets the number of seconds a script is allowed to run. If seconds is set to zero, no time limit is imposed. When called, set_time_limit() restarts the timeout counter from zero. i.e if the timeout is the default 30 seconds, and after 25 seconds into script execution a call set_time_limit(20) is made, the script will allow to run for a total of 45 seconds before timing out.</p>
<p align="justify"><strong>connection_timeout() function.</strong> This function returns TRUE if php connection status is TIMEOUT. Typically this function is useful in registered shutdown functions to do something different in case of php connection status is TIMEOUT.</p>
<p align="justify"><strong>connection_status() function.</strong> Note that both the ABORTED and the TIMEOUT states can be active at the same time. This is possible when ignore_user_abort is set and client disconnected. At this time script will keep running but PHP will still note that it is ABORTED. If it then TIMEOUT it will stop execution of the script and registered shutdown function will be called if registered. At this point connection_timeout() and connection_aborted() will return TRUE. connection_status() can also be used which returns the connection status bitfield. So, if both states are active it would return 3.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpprogramming.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpprogramming.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpprogramming.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpprogramming.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpprogramming.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpprogramming.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phpprogramming.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phpprogramming.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phpprogramming.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phpprogramming.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpprogramming.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpprogramming.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpprogramming.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpprogramming.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpprogramming.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpprogramming.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=10&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phpprogramming.wordpress.com/2007/01/24/php-connection-status-and-connection-handling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29b12765fddabe438d7e2f02833c18a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">V.HPatel</media:title>
		</media:content>
	</item>
		<item>
		<title>php basics</title>
		<link>http://phpprogramming.wordpress.com/2007/01/23/php-basics/</link>
		<comments>http://phpprogramming.wordpress.com/2007/01/23/php-basics/#comments</comments>
		<pubDate>Tue, 23 Jan 2007 13:42:01 +0000</pubDate>
		<dc:creator>V.HPatel</dc:creator>
				<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://phpprogramming.wordpress.com/2007/01/23/php-basics/</guid>
		<description><![CDATA[PHP (Hypertext Preprocessor) ia an Open Source general purpose web scripting language. It is widely used for Web development because it can easily be embedded into HTML. PHP is an easy to learn and you can start developing dynamic webpages very quickly. Moreover PHP can be used in other development areas e.g Command line scripting. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=3&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="justify">PHP (Hypertext Preprocessor) ia an Open Source general purpose web scripting language. It is widely used for Web development because it can easily be embedded into HTML. PHP is an easy to learn and you can start developing dynamic webpages very quickly. Moreover PHP can be used in other development areas e.g Command line scripting.</p>
<p>&lt;html&gt;<br />
  &lt;head&gt;<br />
  &lt;title&gt;Embedding PHP in HTML&lt;/title&gt;<br />
  &lt;/head&gt;<br />
  &lt;body&gt;<br />
  <strong>&lt;?php echo &#8220;Hi, I can easily be embedded into HTML !!!&#8221;; ?&gt;<br />
</strong>  &lt;/body&gt;<br />
&lt;/html&gt;</p>
<p align="justify">PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X, RISC OS, and probably others. PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd, and many others. For the majority of the servers PHP has a module, for the others supporting the CGI standard, PHP can work as a CGI processor.</p>
<p align="justify"><strong>Retrieving IP Address of visitors</strong><br />
You can see from the example above how easily PHP code can be embeded into HTML. Now let us see something more useful. We will check the IP address of the visitor of the page. This can be achieved using PHP as follows.</p>
<p>&lt;html&gt;<br />
    &lt;head&gt;<br />
        &lt;title&gt;IP Address of visitor&lt;/title&gt;<br />
    &lt;/head&gt;<br />
    &lt;body&gt;<br />
<strong>        Your IP Address is : &lt;?php echo $_SERVER['REMOTE_ADDR']; ?&gt;</strong><br />
    &lt;/body&gt;<br />
&lt;/html&gt;</p>
<p align="justify"><strong>Working with forms</strong><br />
Here we will see how to use PHP in working with HTML forms. We will see how one can use PHP to access data filled in HTML forms. Let us have form with Name and Phone Number fields as below.</p>
<p>&lt;form action=&#8221;action.php&#8221; method=&#8221;post&#8221;&gt;<br />
 Name: &lt;input type=&#8221;text&#8221; name=&#8221;name&#8221;&gt;<br />
 Phome: &lt;input type=&#8221;text&#8221; name=&#8221;phone&#8221;&gt;<br />
 &lt;input type=&#8221;Submit&#8221; value=&#8221;Submit&#8221;&gt;<br />
&lt;/form&gt;</p>
<p>Now we will see how values of these fields can be accessed using PHP.</p>
<p>Name: &lt;?php echo $_POST['name']; ?&gt;<br />
Phone: &lt;?php echo $_POST['phone']; ?&gt;</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpprogramming.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpprogramming.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpprogramming.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpprogramming.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpprogramming.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpprogramming.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phpprogramming.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phpprogramming.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phpprogramming.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phpprogramming.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpprogramming.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpprogramming.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpprogramming.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpprogramming.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpprogramming.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpprogramming.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpprogramming.wordpress.com&amp;blog=710913&amp;post=3&amp;subd=phpprogramming&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phpprogramming.wordpress.com/2007/01/23/php-basics/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/29b12765fddabe438d7e2f02833c18a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">V.HPatel</media:title>
		</media:content>
	</item>
	</channel>
</rss>
