<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[PHP Forums]]></title>
	<link rel="self" href="http://phpforums.org/feed-atom.xml"/>
	<updated>2009-12-17T23:09:17Z</updated>
	<generator>PunBB</generator>
	<id>http://phpforums.org/</id>
		<entry>
			<title type="html"><![CDATA[[TUTORIAL] How to make a simple contact form]]></title>
			<link rel="alternate" href="http://phpforums.org/topic16-tutorial-how-to-make-a-simple-contact-form-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hello,</p><p>In this tutorial you will learn how to make a simple contact form:</p><div class="codebox"><pre><code>&lt;?php
if(isset($_POST[&#039;submit&#039;])) {
 

$to = &quot;you@you.com&quot;;
$subject = &quot;Form Tutorial&quot;;
$name_field = $_POST[&#039;name&#039;];
$email_field = $_POST[&#039;email&#039;];
$message = $_POST[&#039;message&#039;];
$option = $_POST[&#039;radio&#039;];
$dropdown = $_POST[&#039;drop_down&#039;];
 
foreach($_POST[&#039;check&#039;] as $value) {

$check_msg .= &quot;Checked: $value\n&quot;;

}
 
$body = &quot;From: $name_field\n E-Mail: $email_field\n $check_msg Option: $option\n Drop-Down: $dropdown\n Message:\n $message\n&quot;;
 
echo &quot;Data has been submitted to $to!&quot;;
mail($to, $subject, $body);
 

} else {
?&gt;

&lt;form method=&quot;POST&quot; action=&quot;mailer.php&quot;&gt;
Name:
&lt;input type=&quot;text&quot; name=&quot;name&quot; size=&quot;19&quot;&gt;&lt;br&gt;
&lt;br&gt;
E-Mail:
&lt;input type=&quot;text&quot; name=&quot;email&quot; size=&quot;19&quot;&gt;&lt;br&gt;
&lt;br&gt;
 
&lt;input type=&quot;checkbox&quot; name=&quot;check[]&quot; value=&quot;blue_color&quot;&gt; Blue&lt;br&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;check[]&quot; value=&quot;green_color&quot;&gt; Green&lt;br&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;check[]&quot; value=&quot;orange_color&quot;&gt; Orange&lt;br&gt;
&lt;br&gt;
&lt;input type=&quot;radio&quot; value=&quot;yes&quot; name=&quot;radio&quot;&gt; YES&lt;br&gt;
&lt;input type=&quot;radio&quot; value=&quot;no&quot; name=&quot;radio&quot;&gt; NO
&lt;br&gt;
&lt;br&gt;
 
&lt;select size=&quot;1&quot; name=&quot;drop_down&quot;&gt;
&lt;option&gt;php&lt;/option&gt;
&lt;option&gt;xml&lt;/option&gt;
&lt;option&gt;asp&lt;/option&gt;
&lt;option&gt;jsp&lt;/option&gt;
&lt;/select&gt;&lt;br&gt;
&lt;br&gt;
Message:&lt;br&gt;
&lt;textarea rows=&quot;9&quot; name=&quot;message&quot; cols=&quot;30&quot;&gt;&lt;/textarea&gt;&lt;br&gt;
&lt;br&gt;
&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;submit&quot;&gt;
&lt;/form&gt;

&lt;?php
}
?&gt;</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[jaydesigns]]></name>
				<uri>http://phpforums.org/user8.html</uri>
			</author>
			<updated>2009-12-17T23:09:17Z</updated>
			<id>http://phpforums.org/topic16-tutorial-how-to-make-a-simple-contact-form-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[hi :)]]></title>
			<link rel="alternate" href="http://phpforums.org/topic25-hi-new-posts.html"/>
			<summary type="html"><![CDATA[<div class="codebox"><pre><code>&lt;?php echo &quot;hi everyone&quot;; ?&gt;</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[jaydesigns]]></name>
				<uri>http://phpforums.org/user18.html</uri>
			</author>
			<updated>2009-11-28T03:58:50Z</updated>
			<id>http://phpforums.org/topic25-hi-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Hi ya]]></title>
			<link rel="alternate" href="http://phpforums.org/topic22-hi-ya-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Just a quick message to say hello to everyone here on the forum.&nbsp; Folks call me Orry, which comes from the mini-series North and South.&nbsp; I love forward to learning and sharing with y&#039;all.</p>]]></summary>
			<author>
				<name><![CDATA[jaydesigns]]></name>
				<uri>http://phpforums.org/user16.html</uri>
			</author>
			<updated>2009-11-21T04:04:19Z</updated>
			<id>http://phpforums.org/topic22-hi-ya-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[For beginners, where to learn?]]></title>
			<link rel="alternate" href="http://phpforums.org/topic24-for-beginners-where-to-learn-new-posts.html"/>
			<summary type="html"><![CDATA[<p>For all the beginners, where is the best place to learn about coding and, for that matter, anything related to getting started?</p>]]></summary>
			<author>
				<name><![CDATA[jaydesigns]]></name>
				<uri>http://phpforums.org/user16.html</uri>
			</author>
			<updated>2009-11-21T04:03:09Z</updated>
			<id>http://phpforums.org/topic24-for-beginners-where-to-learn-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[[TUTORIAL] How to make a simple captcha script]]></title>
			<link rel="alternate" href="http://phpforums.org/topic14-tutorial-how-to-make-a-simple-captcha-script-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hello,</p><p>Here is a tutorial on how to make a simple captcha script</p><div class="codebox"><pre><code>&lt;?php
session_start();
$strlength = rand(4,7);

for($i=1;$i&lt;=$strlength;$i++)
{
$textornumber = rand(1,3);
if($textornumber == 1)
{
$captchastr .= chr(rand(49,57));
}
if($textornumber == 2)
{
$captchastr .= chr(rand(65,78));
}
if($textornumber == 3)
{
$captchastr .= chr(rand(80,90));
}
}
$randcolR = rand(100,230);
$randcolG = rand(100,230);
$randcolB = rand(100,230);

/initialize image $captcha is handle dimensions 200,50
$captcha = imageCreate(200,50);
$backcolor = imageColorAllocate($captcha, $randcolR, $randcolG, $randcolB);

$txtcolor = imageColorAllocate($captcha, ($randcolR - 20), ($randcolG - 20), ($randcolB - 20));
for($i=1;$i&lt;=$strlength;$i++)
{

$clockorcounter = rand(1,2);
if ($clockorcounter == 1)
{
$rotangle = rand(0,45);
}
if ($clockorcounter == 2)
{
$rotangle = rand(315,360);
}

//$i*25 spaces the characters 25 pixels apart
imagettftext($captcha,rand(14,20),$rotangle,($i*25),30,$txtcolor,&quot;/arial.ttf&quot;,substr($captchastr,($i-1),1));
}
for($i=1; $i&lt;=4;$i++)
{
imageellipse($captcha,rand(1,200),rand(1,50),rand(50,100),rand(12,25),$txtcolor);
}
for($i=1; $i&lt;=4;$i++)
{
imageellipse($captcha,rand(1,200),rand(1,50),rand(50,100),rand(12,25),$backcolor);
}
//Send the headers (at last possible time)
header(&#039;Content-type: image/png&#039;);

//Output the image as a PNG
imagePNG($captcha);

//Delete the image from memory
imageDestroy($captcha);

$_SESSION[captchastr] = $captchastr;

?&gt;</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[Orrymain]]></name>
				<uri>http://phpforums.org/user8.html</uri>
			</author>
			<updated>2009-11-20T01:35:13Z</updated>
			<id>http://phpforums.org/topic14-tutorial-how-to-make-a-simple-captcha-script-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[What PHP editor do you use?]]></title>
			<link rel="alternate" href="http://phpforums.org/topic4-what-php-editor-do-you-use-new-posts.html"/>
			<summary type="html"><![CDATA[<p>What editor you are using to do your PHP work? Feel free to let us know your opinion about it.</p><p>Personally, I do my PHP development work with the help of Aptana and Notepad++. I love the speed of Notepad++ and the feature set of Aptana. Both are great and feature full PHP editors, which satisfy my needs to the fullest.</p><br /><p>How about you?</p>]]></summary>
			<author>
				<name><![CDATA[Orrymain]]></name>
				<uri>http://phpforums.org/user2.html</uri>
			</author>
			<updated>2009-11-20T01:33:40Z</updated>
			<id>http://phpforums.org/topic4-what-php-editor-do-you-use-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How Long on the Internet]]></title>
			<link rel="alternate" href="http://phpforums.org/topic23-how-long-on-the-internet-new-posts.html"/>
			<summary type="html"><![CDATA[<p>I was just curious how long everyone has been on the internet, or just online for that matter?&nbsp; I got online in the early to mid-90&#039;s before the internet was booming.</p>]]></summary>
			<author>
				<name><![CDATA[Orrymain]]></name>
				<uri>http://phpforums.org/user16.html</uri>
			</author>
			<updated>2009-11-18T22:08:03Z</updated>
			<id>http://phpforums.org/topic23-how-long-on-the-internet-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Do you have a pet?]]></title>
			<link rel="alternate" href="http://phpforums.org/topic1-do-you-have-a-pet-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hi there!</p><p>Do you have a pet, and if so, what is it and what is its name?</p><p>Personally, I have a cat and a dog. Dog&#039;s name is Max, but the cat&#039;s Greta. Max is so black that is barely visible when walking with him in the dark. <img src="http://phpforums.org/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /> Greta is a crazy cat girl turning all the rooms upside down. She also likes to be on the front of the camera, I&#039;ve attached a photo of her.</p>]]></summary>
			<author>
				<name><![CDATA[Orrymain]]></name>
				<uri>http://phpforums.org/user2.html</uri>
			</author>
			<updated>2009-11-17T20:58:25Z</updated>
			<id>http://phpforums.org/topic1-do-you-have-a-pet-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Where are you from?]]></title>
			<link rel="alternate" href="http://phpforums.org/topic17-where-are-you-from-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hello,</p><p>I am from Massachusetts, United States.</p><p>Where are you from?</p>]]></summary>
			<author>
				<name><![CDATA[Orrymain]]></name>
				<uri>http://phpforums.org/user8.html</uri>
			</author>
			<updated>2009-11-17T20:57:05Z</updated>
			<id>http://phpforums.org/topic17-where-are-you-from-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[[TUTORIAL] How to make a simple calculator]]></title>
			<link rel="alternate" href="http://phpforums.org/topic15-tutorial-how-to-make-a-simple-calculator-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hello,</p><p>In this tutorial you will learn how to make a simple PHP calculator</p><div class="codebox"><pre><code>&lt;?php

if($submit)
{
   if($operator == &#039;*&#039;)
   {
       echo $numa * $numb;
   } elseif($operator == &#039;/&#039;)
   {
       echo $numa / $numb;
   } elseif($operator == &#039;+&#039;)
   {
       echo $numa + $numb;
   } elseif($operator == &#039;-&#039;)
   {
       echo $numa - $numb;
   }
} else { ?&gt;
&lt;form method=&quot;POST&quot; action=&quot;&lt;?php $_SERVER[&#039;PHP_SELF&#039;]; ?&gt;&quot;&gt;
 &lt;input type=&quot;text&quot; name=&quot;numa&quot; size=&quot;10&quot;&gt;
 &lt;select name=&quot;operator&quot;&gt;
 &lt;option value=&quot;+&quot;&gt;Add&lt;/option&gt;
 &lt;option value=&quot;-&quot;&gt;Subtract&lt;/option&gt;
 &lt;option value=&quot;*&quot;&gt;Multiply&lt;/option&gt;
 &lt;option value=&quot;/&quot;&gt;Divide&lt;/option&gt;
 &lt;/select&gt;
 &lt;input type=&quot;text&quot; name=&quot;numb&quot; size=&quot;10&quot;&gt;
 &lt;input type=&quot;submit&quot; value=&quot;Calculate&quot; name=&quot;submit&quot;&gt;
&lt;/form&gt;
&lt;?php } ?&gt;

Read more: http://www.webdesign.org/web/web-programming/php/php-calculator.10025.html#ixzz0TUVwwSds</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[Orrymain]]></name>
				<uri>http://phpforums.org/user8.html</uri>
			</author>
			<updated>2009-11-17T20:54:26Z</updated>
			<id>http://phpforums.org/topic15-tutorial-how-to-make-a-simple-calculator-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[[IDEA] Change Main page new posts]]></title>
			<link rel="alternate" href="http://phpforums.org/topic18-idea-change-main-page-new-posts-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hello,</p><p>I think you should post instead of the date the post was made to the name of thread that was posted in.</p><p>Just an idea if you need help doing this just let me know via PM or right here.</p><p>-John</p>]]></summary>
			<author>
				<name><![CDATA[jaydesigns]]></name>
				<uri>http://phpforums.org/user8.html</uri>
			</author>
			<updated>2009-10-16T20:23:59Z</updated>
			<id>http://phpforums.org/topic18-idea-change-main-page-new-posts-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Hello All!]]></title>
			<link rel="alternate" href="http://phpforums.org/topic20-hello-all-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hello! I&#039;m new. The forum looks pretty empty now, but anyway I decided to join. Looking to learn some web development.</p>]]></summary>
			<author>
				<name><![CDATA[jaydesigns]]></name>
				<uri>http://phpforums.org/user12.html</uri>
			</author>
			<updated>2009-10-16T20:22:08Z</updated>
			<id>http://phpforums.org/topic20-hello-all-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[if empty]]></title>
			<link rel="alternate" href="http://phpforums.org/topic21-if-empty-new-posts.html"/>
			<summary type="html"><![CDATA[<p>all clear for what is meant if(empty($field))</p><p>i dont like the fact that the field is no longer seen as empty if it consists even of one space</p><p>how to make that the field is empty although it would contain even 100 spaces?</p><p>thanks</p>]]></summary>
			<author>
				<name><![CDATA[Earl]]></name>
				<uri>http://phpforums.org/user7.html</uri>
			</author>
			<updated>2009-10-13T09:47:24Z</updated>
			<id>http://phpforums.org/topic21-if-empty-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Header errors - read here before posting them!]]></title>
			<link rel="alternate" href="http://phpforums.org/topic19-header-errors-read-here-before-posting-them-new-posts.html"/>
			<summary type="html"><![CDATA[<p>i&#039;ve seen this error pop up time and time again, and the answer is ALWAYS the same.&nbsp; please look here before you post it.&nbsp; the problem is you are outputting to the browser (whitespace included) before sending a header.&nbsp; this is unallowed.&nbsp; remove output prior to the header, or use OUTPUT BUFFERING.</p><p>NEW EDIT TO THIS TOPIC:</p><p>what usually results in these errors is poor script design.&nbsp; when one processes a form, they should do it BEFORE OUTPUTTING ANYTHING TO THE BROWSER.&nbsp; there is NO reason that the process cannot be operated in the header of the document, before any HTML is output.</p><p>let&#039;s take a common example.&nbsp; the programmer wants a login form which checks the username and password against the database.&nbsp; if they don&#039;t match, then don&#039;t set a cookie remembering them and tell them it failed.&nbsp; if they do match, set the cookie and send them to a member page.&nbsp; many will do:</p><p>[HTML starting the page and layout]<br />[PHP processing the form]<br />[form code]</p><p>because they can simply echo any errors straight from PHP right above that form.&nbsp; they can also send a success message, set the cookie, and header() them off on their merry way without seeing the form again.&nbsp; it&#039;s a logical place to put this code.&nbsp; think again.&nbsp; you&#039;ll (perhaps not so) obviously get header errors when you go to use setcookie() and header().&nbsp; if the login fails, it&#039;s dandy, but if you have a successful login the user gets nowhere.</p><p>answer:&nbsp; put the processing in the header, and store the results in variables.&nbsp; perhaps a $result variable that is 1 if successful, 0 if failed.&nbsp; then $output that contains either a success message or customized error messages.&nbsp; the new code would look like:</p><p>[PHP processing the form (if it was sent) and storing the results]<br />[HTML starting the page and layout]<br />[PHP echoing the results]<br />[form code if failed - exit(); if successful]</p><p>this will solve your header errors and will make for much more maintainable and readable code.&nbsp; if you want to redirect them elegantly (with a success message), use a &lt;meta&gt; refresh redirect.&nbsp; header() should only be used in instances where instant redirection is desired.</p>]]></summary>
			<author>
				<name><![CDATA[jaydesigns]]></name>
				<uri>http://phpforums.org/user8.html</uri>
			</author>
			<updated>2009-10-10T01:27:46Z</updated>
			<id>http://phpforums.org/topic19-header-errors-read-here-before-posting-them-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[[Tutorial] How to find if a number is odd or even]]></title>
			<link rel="alternate" href="http://phpforums.org/topic13-tutorial-how-to-find-if-a-number-is-odd-or-even-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hi there!</p><p>In this tutorial I&#039;ll write some basic PHP code on how to find if a number is odd or even.</p><p>The idea behind the code is that even numbers have zero reminder when divided by 2, while odd numbers have 1 as a reminder after division by 2. For this I&#039;ll use PHP modulus operator (%).</p><div class="codebox"><pre><code>&lt;?php
if ($number % 2 == 0)
{
    echo &quot;even&quot;;
}
else
{
    echo &quot;odd&quot;;
}
?&gt;</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[Einherjar]]></name>
				<uri>http://phpforums.org/user2.html</uri>
			</author>
			<updated>2009-10-08T23:27:10Z</updated>
			<id>http://phpforums.org/topic13-tutorial-how-to-find-if-a-number-is-odd-or-even-new-posts.html</id>
		</entry>
</feed>
