<?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>Nancy Fusco &#187; form</title>
	<atom:link href="http://nancyfusco.com/wp/index.php/tag/form/feed/" rel="self" type="application/rss+xml" />
	<link>http://nancyfusco.com/wp</link>
	<description></description>
	<lastBuildDate>Sun, 29 Apr 2012 14:45:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>PHP form to email tutorial &#8211; Part 1 &#8211; Setting up the form</title>
		<link>http://nancyfusco.com/wp/index.php/2009/03/php-form-to-email-tutorial-part-1/</link>
		<comments>http://nancyfusco.com/wp/index.php/2009/03/php-form-to-email-tutorial-part-1/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 17:47:43 +0000</pubDate>
		<dc:creator>Nancy</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://nancyfusco.com/wp/?p=629</guid>
		<description><![CDATA[This weekend I did some volunteer work for a local non-profit by constructing an online form in php that would email from their website. I&#8217;m going to simplify that form and walk thru a tutorial to help you build your own online php forms. Part 1 will walk you thru setting up the actual form [...]]]></description>
			<content:encoded><![CDATA[<p>This weekend I did some volunteer work for a local non-profit by constructing an online form in php that would email from their website. I&#8217;m going to simplify that form and walk thru a tutorial to help you build your own online php forms.</p>
<p>Part 1 will walk you thru setting up the actual form to get it ready to be processed by the PHP script. The form just gets the information to the PHP script. </p>
<p><a href="http://nancyfusco.com/wp/index.php/2009/03/php-form-to-email-tutorial-part-2/" target="_blank">Part 2</a> will be the setup of the receiving PHP script, which will process the info from the form and email it.</p>
<p><a href="http://nancyfusco.com/wp/index.php/2009/03/php-form-to-email-tutorial-part-3/" target="_blank">Part 3</a> will look at client-side validation with Javascript.</p>
<p>Part 4 we will create a multiple choice input area for the user, and only emailing their selections in the form. We will do this by creating an Array.</p>
<p>Part 5 will create code to also email a confirmation to the user with the info they filled out.</p>
<p>A well designed form will set the stage for easy processing so, with that said, let&#8217;s dive into the form construction. <span id="more-629"></span></p>
<p>Open your html editor, for most it will be Dreamweaver or similar. I use <a href="http://quanta.kdewebdev.org/" target="_blank">Quanta+</a>, an open-source software for Linux. Create a new PHP document.</p>
<p>First, let&#8217;s add the form elements to our web page, take notice that we are defining the name, method, and action:<br />
<code>&lt;html&gt;<br />
&lt;head&gt;&lt;/head&gt;<br />
&lt;form name="adReg" method="POST" action="adaction2.php"&gt;<br />
&lt;/form&gt;<br />
&lt;/html&gt;</code></p>
<p>name = how we will refer to our form<br />
method = POST &#8211; how we will send our data over to PHP &#8211; this is the transport<br />
action = when a user clicks the Submit button, where the form should send it&#8217;s data.</p>
<p>Now, inside the form tags, let&#8217;s add just two items, keeping it simple for right now:<br />
<code>&lt;form name="adReg" method="POST" action="adaction2.php"&gt;<br />
Contact Name:<br />
&lt;input type="text" name="cName"&gt;<br />
Notes:<br />
&lt;textarea name="notes"&gt;&lt;/textarea&gt;<br />
&lt;/form&gt;</code></p>
<p>Notice again, we have to define the elements in our form so that in our PHP script we know how to refer to them.</p>
<p>All we need to do now is add in the Submit button and a few line breaks for spacing:</p>
<p><code>&lt;html&gt;<br />
&lt;head&gt;&lt;/head&gt;<br />
&lt;form name="adReg" method="POST" action="adaction2.php"&gt;<br />
Contact Name:<br />
&lt;br /&gt;<br />
&lt;input type="text" name="cName"&gt;<br />
&lt;br /&gt;<br />
Notes:<br />
&lt;br /&gt;<br />
&lt;textarea name="notes"&gt;&lt;/textarea&gt;<br />
&lt;br /&gt;<br />
&lt;input type="submit" name="submit" value="Submit"&gt;<br />
&lt;/form&gt;<br />
&lt;/html&gt;</code></p>
<p>Preview your PHP page and you should see this basic form:</p>
<form name="adReg" method="POST" action="adaction2.php">
Contact Name:<br />
</p>
<input type="text" name="cName">
<br />
Notes:<br />
<br />
<textarea name="notes"></textarea><br />
</p>
<input type="submit" name="submit" value="Submit">
</form>
<p>That&#8217;s it! Pretty easy right? Now if you click the Submit button above, it won&#8217;t actually do anything &#8211; yet &#8211; visit back for Part 2 where we will construct the actual PHP code that will take the info from the form we created and send it via email.</p>
]]></content:encoded>
			<wfw:commentRss>http://nancyfusco.com/wp/index.php/2009/03/php-form-to-email-tutorial-part-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

