<?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>NewSourceMedia Blog &#187; PHP</title>
	<atom:link href="http://newsourcemedia.com/blog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://newsourcemedia.com/blog</link>
	<description>Focused on Interactive Design, Development and Marketing</description>
	<lastBuildDate>Fri, 30 Dec 2011 04:30:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Fix SQL INSERT problems with PHP addslashes function</title>
		<link>http://newsourcemedia.com/blog/sql-insert-php-addslashes-fix/</link>
		<comments>http://newsourcemedia.com/blog/sql-insert-php-addslashes-fix/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 01:54:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL / Database]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[insert]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/?p=643</guid>
		<description><![CDATA[If you've created you own custom content management system using PHP, you may have noticed problems inserting data. One of the problems could be that your data may have characters that prevent it from being inserted. Some of the character &#8230; <a href="http://newsourcemedia.com/blog/sql-insert-php-addslashes-fix/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[If you've created you own custom content management system using PHP, you may have noticed problems inserting data. One of the problems could be that your data may have characters that prevent it from being inserted. Some of the character that would cause this type of problem are single or double quotes, backslash, and NUL characters.

You can escape these problematic characters using the PHP function addslashes(). As explained by the PHP manual: It returns a string with backslashes before characters that need    to be quoted in database queries etc.  These characters are    single quote (<em>'</em>), double quote    (<em>"</em>), backslash (<em>\</em>)    and NUL (the <strong><tt>NULL</tt></strong> byte).

As you can see from my example below, I first run the content through the addshashes function and than return it to the same named string "$Page_Content" before passing it to my SQL UPDATE or INSERT statement.
<pre lang="php">$Page_Content = addslashes($Page_Content);
$query = "UPDATE site_content SET Page_Title='$Page_Title', Page_Content='$Page_Content' WHERE id_f='$id_f'";
query_db($query);
</pre>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/sql-insert-php-addslashes-fix/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to backup MySQL Database via SSH</title>
		<link>http://newsourcemedia.com/blog/how-to-backup-mysql-database-via-ssh/</link>
		<comments>http://newsourcemedia.com/blog/how-to-backup-mysql-database-via-ssh/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 02:44:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[MySQL / Database]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[Web Servers]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[compress]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/how-to-backup-mysql-database-via-ssh/</guid>
		<description><![CDATA[First you log in using your terminal application by typing the flowing SSH command: ssh yourusername@hostname-or-ipaddress After that, you will be prompted to enter your password. As you enter your password, the text will be hidden. Next we should switch &#8230; <a href="http://newsourcemedia.com/blog/how-to-backup-mysql-database-via-ssh/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[First you log in using your terminal application by typing the flowing SSH command:

ssh yourusername@hostname-or-ipaddress

After that, you will be prompted to enter your password. As you enter your password, the text will be hidden. Next we should switch to the "root" user. You can do so by typing the following in your terminal window:

su - root

You will have to enter a password once more. Now navagate to where you would like to store your MySQL database file. For an example of changing the directory to the "public_html" direcotry, type this:

cd /var/www/html_public

Now you can back up your db here using the following command. This command will backup all of your databases. I also chose to compress them after the pipe "|" as a gzip file. Type the following but be sure to change the user name and password to your info:

mysqldump -u yourusername -p yourpassword --all-databases | gzip &gt;databasebackup.sql.gz

You can also target single database using the following:

mysqldump -u yourUserName -p yourDBName | gzip &gt;databasebackup.sql.gz]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/how-to-backup-mysql-database-via-ssh/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to validate Flash absolute url paths</title>
		<link>http://newsourcemedia.com/blog/how-to-validate-flash-absolute-url-paths/</link>
		<comments>http://newsourcemedia.com/blog/how-to-validate-flash-absolute-url-paths/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 15:50:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Manipulation]]></category>
		<category><![CDATA[Workarounds]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/?p=583</guid>
		<description><![CDATA[You may want to dynamically change the way your flash file behaves based on where it's hosted. To do so, you should utilize the "_url" variable to obtain the absolute path of your flash file. Actionscript 2: [as2] var path &#8230; <a href="http://newsourcemedia.com/blog/how-to-validate-flash-absolute-url-paths/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[You may want to dynamically change the way your flash file behaves based on where it's hosted. To do so, you should utilize the  "_url" variable to obtain the absolute path of your flash file.<span id="more-583"></span>

Actionscript 2:
[as2]
var path = _root._url;
trace (path);
// here's how to validate if the flash file is running locally off line.
trace (_root._url.substr(0,7));
if(_root._url.substr(0,7)=="file://"){
trace("running offline");
}
[/as2]]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/how-to-validate-flash-absolute-url-paths/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Swap Depth using AS3 via setChildIndex</title>
		<link>http://newsourcemedia.com/blog/as3-getnexthighestdepth-is-no-longer-supported/</link>
		<comments>http://newsourcemedia.com/blog/as3-getnexthighestdepth-is-no-longer-supported/#comments</comments>
		<pubDate>Mon, 11 May 2009 20:20:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[Workarounds]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/?p=534</guid>
		<description><![CDATA[How to swap depth using AS3 via setChildIndex. This will fix the Warning: 1060: Migration issue: The method getNextHighestDepth is no longer supported. For reference, here  is how depth management was done using AS2: mc.onRollOver = function():Void { // move &#8230; <a href="http://newsourcemedia.com/blog/as3-getnexthighestdepth-is-no-longer-supported/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[How to swap depth using AS3 via setChildIndex. This will fix the Warning: 1060: Migration issue: The method getNextHighestDepth is no longer supported.<span id="more-534"></span>

<strong>For reference, here  is how depth management was done using AS2:</strong>
<pre lang="actionscript">mc.onRollOver = function():Void
{
// move current movie clip forward to the next highest depth
this.swapDepths(this._parent.getNextHighestDepth());
}</pre>
<strong>Here's how to swap depth in Actionscript 3.</strong>

Use the setChildIndex method to changes the position of an existing child in the display object container with the instances name "holder_mc". This affects the layering of child objects. This example used below attaches a movie clip from the library three times. That movie clip Linkage class is named "MyMC". Inside of that movie clip is a nested movie clip not a graphic shape. I made sure to use a nested movie clip so we could dynamically attach variable and target them later via the mouse event.
<pre lang="actionscript">// loop through to create three mc's on stage
for (var i:int = 0; i <3; i++) {
var myColor:ColorTransform = new ColorTransform();
myColor.color = (Math.random() * 0xFFFFFF);
var mc:MovieClip = new MyMC();
mc.x = ((i * 80) + mc.width);
mc.y = 100;
mc.id = i;
mc.name = "b"+i;
mc.transform.colorTransform = myColor;
mc.buttonMode = true;
mc.addEventListener (MouseEvent.MOUSE_OVER, swapDepths);
holder_mc.addChild (mc);
}

function swapDepths (e:MouseEvent):void {
var mc:MovieClip;
mc = e.target.parent;
trace (mc.id);
holder_mc.setChildIndex (holder_mc.getChildByName("b"+mc.id), (holder_mc.numChildren - 1));
}</pre>
The most important part above is the setChildIndex referencing the current child by name (getChildByName) and finding the highest index number (numChildren-1) for placement.]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/as3-getnexthighestdepth-is-no-longer-supported/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PHP Remove last character from string</title>
		<link>http://newsourcemedia.com/blog/php-remove-last-character/</link>
		<comments>http://newsourcemedia.com/blog/php-remove-last-character/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 01:55:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Manipulation]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[character]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[end]]></category>
		<category><![CDATA[extract]]></category>
		<category><![CDATA[last]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[update.]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/?p=515</guid>
		<description><![CDATA[Want to remove the last character from your text. Just use Substr_Replace. This is how. PHP's substr_replace replaces text within a portion of a string. In this case we only want to replace the last character with nothing. Here is &#8230; <a href="http://newsourcemedia.com/blog/php-remove-last-character/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[Want to remove the last character from your text. Just use Substr_Replace. This is how.<span id="more-515"></span>

PHP's substr_replace replaces text within a portion of a string. In this case we only want to replace the last character with nothing. Here is the code sample:

<pre lang="php">$old_string = "My-Category-";
// remove the last hyphen from the string
$new_string = substr_replace($old_string,"",-1);
echo $new_string;
// should now read "My-Category"
</pre>
This should replace the last character of a string with nothing.]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/php-remove-last-character/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Select UNIQUE or DISTINCT MySQL/PHP Queries</title>
		<link>http://newsourcemedia.com/blog/select-unique-or-distinct-mysqlphp-queries/</link>
		<comments>http://newsourcemedia.com/blog/select-unique-or-distinct-mysqlphp-queries/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 20:09:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL / Database]]></category>
		<category><![CDATA[distinct]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[results]]></category>
		<category><![CDATA[unique]]></category>
		<category><![CDATA[unwanted]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/?p=502</guid>
		<description><![CDATA[How to filter / remove duplicate items in your database query result using DISTINCT Say you wanted to show a list of client names from using a portfolio projects database. The problem is you may have multiple portfolio projects for &#8230; <a href="http://newsourcemedia.com/blog/select-unique-or-distinct-mysqlphp-queries/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[How to filter / remove duplicate items in your database query result using DISTINCT

<span id="more-502"></span>Say you wanted to show a list of client names from using a portfolio projects database. The problem is you may have multiple portfolio projects for the same client. So if you ran that list, you could get something like: Nike, Nike, Audi, BMW, BMW, Kmart and Ford. Here is how to clean up all duplicate using the "DISTINCT" clause.

<pre lang="php">$query = "SELECT DISTINCT Client_Name FROM Portfolio ORDER BY Client_Name ASC";
$result = query_db($query);

while ($myrow = mysql_fetch_array($result))
{
echo $myrow[Client_Name].", ";
}</pre>

Notice how we did not add in "limit 0,1". DISTINCT does this for us. It will only return one item.

You want to use it without any other columns, otherwise you are going to need a GROUP BY clause.]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/select-unique-or-distinct-mysqlphp-queries/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP how to find Odd and Even numbers</title>
		<link>http://newsourcemedia.com/blog/php-how-to-find-odd-and-even-numbers/</link>
		<comments>http://newsourcemedia.com/blog/php-how-to-find-odd-and-even-numbers/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 06:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Math and Numbers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[check]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[compair]]></category>
		<category><![CDATA[digits]]></category>
		<category><![CDATA[even]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[match]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[odd]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-how-to-find-odd-and-even-numbers/</guid>
		<description><![CDATA[Here is how to find odd and even numbers in php. How to find if a number is odd or even? In PHP I learn to use the MOD (%) operator. see below for an example: $i = 10; if &#8230; <a href="http://newsourcemedia.com/blog/php-how-to-find-odd-and-even-numbers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[Here is how to find odd and even numbers in php.
<span id="more-173"></span>

How to find if a number is odd or even?
In PHP I learn to use the MOD (%) operator. see below for an example: <code>$i = 10;</code>

<code>if ($i % 2) {
echo "$i is odd";
} else {
echo "$i is even";
}
</code>

You can also use the PHP "&amp;" operator that will give you better   performance
You can use the PHP code like so:

<code>$i = 10;
if ( $i&amp;1 )
{
echo "$i is odd";
}
else
{
echo "$i is even";
}</code>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/php-how-to-find-odd-and-even-numbers/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>MySQL DISTINCT to Remove Duplicate Listing</title>
		<link>http://newsourcemedia.com/blog/mysql-distinct-to-remove-duplicate-listing/</link>
		<comments>http://newsourcemedia.com/blog/mysql-distinct-to-remove-duplicate-listing/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 06:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL / Database]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[clean up]]></category>
		<category><![CDATA[distinct]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[result]]></category>
		<category><![CDATA[uniqe]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/mysql-distinct-to-remove-duplicate-listing/</guid>
		<description><![CDATA[How to select and display records from MySQL table using the DISTINCT keyword for unique data. This is for removing duplicated results in order to gain unique listings from your database table using the DISTINCT keyword in your MySQL select &#8230; <a href="http://newsourcemedia.com/blog/mysql-distinct-to-remove-duplicate-listing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[How to select and display records from MySQL table using the DISTINCT keyword for unique data.
<span id="more-165"></span>

This is for removing duplicated results in order to gain unique listings from
your database table using the DISTINCT keyword in your
MySQL select statement .

For example if you ran this:
<pre class="co">Select Cars FROM Cars_Listing
======== Results =======
BMW
BMW
HONDA
BENZ
BENZ
BMW
FORD
FORD
=======================</pre>
Notice how there is more then one BMW.

Here is how to clean up that result by using the DISTINCT keyword in your
MySQL select statement
<pre class="co">Select DISTINCT Cars FROM Cars_Listing
======== Results =======
BMW
HONDA
BENZ
FORD
=======================</pre>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/mysql-distinct-to-remove-duplicate-listing/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Sort Directory Listings</title>
		<link>http://newsourcemedia.com/blog/sort-directory-listings/</link>
		<comments>http://newsourcemedia.com/blog/sort-directory-listings/#comments</comments>
		<pubDate>Tue, 02 Dec 2003 00:22:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[Files and Folders]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/sort-directory-listings/</guid>
		<description><![CDATA[Here is some code to help sort the order of your directory output. This is greate for creating PHP FTP applications. sort() General Example 1. $fruits = array("lemon", "orange", "banana", "apple"); sort($fruits); reset($fruits); while (list($key, $val) = each($fruits)) { echo &#8230; <a href="http://newsourcemedia.com/blog/sort-directory-listings/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[Here is some code to help sort the order of your directory output. This is greate for creating PHP FTP applications.
<span id="more-236"></span>

<strong> <span style="color: #006600; font-size: large;">sort()</span></strong>

<strong>General Example 1.</strong>

<span style="color: #ff6600;"> $fruits = array("lemon", "orange", "banana", "apple");
sort($fruits);
reset($fruits);
while (list($key, $val) = each($fruits)) {
echo "fruits[".$key."] = ".$val."\n";
}
?&gt;</span>

<strong>Directory Example 1. A simple scandir() example</strong>

<span style="color: #ff6600;"> $dir = '/tmp';
$files1 = scandir($dir);
$files2 = scandir($dir, 1);
print_r($files1);
print_r($files2);</span>
<span style="color: #666666;">/* Outputs something like:
Array
(
[0] =&gt; .
[1] =&gt; ..
[2] =&gt; bar.php
[3] =&gt; foo.txt
[4] =&gt; somedir
)
Array
(
[0] =&gt; somedir
[1] =&gt; foo.txt
[2] =&gt; bar.php
[3] =&gt; ..
[4] =&gt; .
)
*/</span>
<span style="color: #ff6600;">?&gt;</span>

<strong>Directory Example 2. PHP 4 alternatives to scandir()</strong>

<span style="color: #ff6600;"> $dir = "/tmp";
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
sort($files);
print_r($files);
rsort($files);
print_r($files);</span>
<span style="color: #666666;">/* Outputs something like:
Array
(
[0] =&gt; .
[1] =&gt; ..
[2] =&gt; bar.php
[3] =&gt; foo.txt
[4] =&gt; somedir
)
Array
(
[0] =&gt; somedir
[1] =&gt; foo.txt
[2] =&gt; bar.php
[3] =&gt; ..
[4] =&gt; .
)
*/</span>
<span style="color: #ff6600;">?&gt; </span>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/sort-directory-listings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Email Form Easy</title>
		<link>http://newsourcemedia.com/blog/php-email-form-easy/</link>
		<comments>http://newsourcemedia.com/blog/php-email-form-easy/#comments</comments>
		<pubDate>Fri, 02 Jul 2004 00:22:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Forms]]></category>
		<category><![CDATA[comunication]]></category>
		<category><![CDATA[cyberxmedia]]></category>
		<category><![CDATA[PHP Email Form Easy]]></category>
		<category><![CDATA[PHP Tips and Tutorials Email Systems]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-email-form-easy/</guid>
		<description><![CDATA[Now you can send emails from your web sites with full control over design style and functionality. PHP is the way to go for online email form. Here is how to get started. Now you can send emails from your &#8230; <a href="http://newsourcemedia.com/blog/php-email-form-easy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[Now you can send emails from your web sites with full control over design style and functionality. PHP is the way to go for online email form. Here is how to get started.
<span id="more-222"></span>Now you can send emails from your web sites with full control over design            style and functionality. PHP is the way to go for online email form.            Here is how to get started.

<strong>Step 1: Create E-Mail Form</strong>

Here is a sample html email form

<span style="color: #009900;">&lt;form action="" method="post"&gt;</span><span style="color: #003399;">
Name: &lt;br&gt;
&lt;input type="text" name="name"&gt;
&lt;br&gt;
Email: &lt;br&gt;
&lt;input type="text" name="email"&gt;
&lt;br&gt;
Subject: &lt;br&gt;
&lt;input type="text" name="subject"&gt;
&lt;br&gt;
Text:&lt;br&gt;
&lt;textarea name="message" cols="" rows=""&gt;&lt;/textarea&gt;&lt;br&gt;
&lt;input type="submit" name="submit" value="Send"&gt;
&lt;input type="reset" name="Reset" value="Reset"&gt;
<span style="color: #009900;">&lt;/form&gt;</span></span>

Copy the html code above and past it into a file with the name contactus.php

Now its time to add the php code.

<strong>Step 2: Sending the data</strong>

We will first check to see if the form was submitted then we will check to see if all fields were filled in. If all is well, we well send each form data to it's perspective variables (indicated by the sign "$") and send out the email with a successful message. If all field were not filled-in, then display an error message. The php code is below.

<span style="color: #006600;">&lt;?php
if ($submit) { <span style="color: #ff9900;">// if the form was sent do the            following</span></span>

<span style="color: #006600;">if($name &amp;&amp; $subject            &amp;&amp; $email &amp;&amp; $message ) { <span style="color: #ff9900;">// if            all fields were filled-in send email</span>
mail("you@youraddress.com","$subject","$message","From:            $name &lt;$email&gt;") or die("email error");
echo "Message Sent"; <span style="color: #ff9900;">// if all went            well, display message was sent</span>
} else {
echo "All fields must be filled in!&lt;BR&gt;"; <span style="color: #ff9900;">//            if not all were filled in, display error message</span>
}
} <span style="color: #ff9900;">// end php submission code</span>
?&gt;</span>

Now just copy and past the php code above into the "contactus.php"    file. You can place it anywhere inside the body tag and it will work just fine.

Be sure to check for the next PHP Advanced Email Form coming soon to NewSourceMedia.com    .

<!--   Start of HTML Code   --->
<table border="1" cellspacing="0" cellpadding="4" width="250" bgcolor="#d70500" bordercolor="#840300"><form action="http://www.hotscripts.com/cgi-bin/rate.cgi" method="post">
<tbody>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td><strong><span style="font-family: Verdana,Arial; color: #ffffff; font-size: xx-small;">If you like our  script, please rate it!</span></strong>

<input name="ID" type="hidden" value="28522" /> <input name="external" type="hidden" value="1" /></td>
</tr>
<tr>
<td><select name="rate" size="1"> <option selected="selected" value="5">Excellent!</option> <option value="4">Very Good</option> <option value="3">Good</option> <option value="2">Fair</option> <option value="1">Poor</option> </select> <input name="submit" type="submit" value="Cast My Vote!" /></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></form></table>
<!--   End of HTML Code   --->Amazon.com has a variety of book on PHP <a href="http://www.amazon.com/exec/obidos/external-search/102-4705021-0991362?mode=books&amp;keyword=PHP&amp;Go=Go&amp;tag=newsourcemedi-20" target="_blank">Click    here to see the list of PHP books available.</a>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/php-email-form-easy/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
