<?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>Digital Park freelance web design</title>
	<atom:link href="http://blog.digitalpark.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.digitalpark.co.uk</link>
	<description>Tutorials, Web Design trends and updates</description>
	<lastBuildDate>Fri, 16 Oct 2009 13:24:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple PHP form validation script</title>
		<link>http://blog.digitalpark.co.uk/simple-php-form-validation-script/</link>
		<comments>http://blog.digitalpark.co.uk/simple-php-form-validation-script/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 13:24:54 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Basic PHP Blogging]]></category>
		<category><![CDATA[Digital Park tutorials]]></category>
		<category><![CDATA[PHP form validation]]></category>
		<category><![CDATA[reduce contact form spam]]></category>
		<category><![CDATA[Validation script]]></category>

		<guid isPermaLink="false">http://blog.digitalpark.co.uk/?p=31</guid>
		<description><![CDATA[Creating a very simple PHP script that will stop some basic spam bots submitting blank or spam messages in contact forms.
What we need to do is call the parameters and check to see if what has been submitted is blank or if it contains data. Also we will check to see if the email that [...]]]></description>
			<content:encoded><![CDATA[<p>Creating a very simple PHP script that will stop some basic spam bots submitting blank or spam messages in contact forms.</p>
<p>What we need to do is call the parameters and check to see if what has been submitted is blank or if it contains data. Also we will check to see if the email that is entered has to correct characteristics of an email address.</p>
<p>If you are new to html and PHP this is a rather easy tutorial to follow I will explain in detail what each function is and how it works.</p>
<p>So lets start by creating our very simple contact form.</p>
<div style="border:1px solid #fff;background:#ececec;font:tahoma;font-size:12px;">&lt;form action=&#8221;sendmail.php&#8221; method=&#8221;post&#8221;&gt;&lt;label&gt;*Name:&lt;/label&gt;&lt;input name=&#8221;name&#8221; type=&#8221;text&#8221; /&gt;<br />
&lt;label&gt;*Email:&lt;/label&gt;&lt;input name=&#8221;email&#8221; type=&#8221;text&#8221; /&gt;<br />
&lt;label&gt;Tel:&lt;/label&gt;&lt;input name=&#8221;tel&#8221; type=&#8221;text&#8221; /&gt;<br />
&lt;label&gt;*Comment:&lt;/label&gt;&lt;textarea rows=&#8221;4&#8243; name=&#8221;comment&#8221;&gt;&lt;/textarea&gt;<br />
&lt;input name=&#8221;submit&#8221; type=&#8221;submit&#8221; value=&#8221;Submit&#8221; /&gt;<br />
* marked as required<br />
&lt;/form&gt;</div>
<p>Lets just talk through this quickly so you understand.</p>
<div style="border:1px solid #fff;background:#ececec;font:tahoma;font-size:12px;">&lt;form action=&#8221;sendmail.php&#8221; method=&#8221;post&#8221;&gt;</div>
<p>Tells our form what action to take and the method of which to send the information to the sendmail.php</p>
<p>Okay so lets just explain the next part. We need to add Labels as our names you can use these to style in CSS or you can just add your own default style.</p>
<div style="border:1px solid #fff;background:#ececec;font:tahoma;font-size:12px;">&lt;label&gt;*Name:&lt;/label&gt;&lt;input name=&#8221;name&#8221; type=&#8221;text&#8221; /&gt;</div>
<p>This shows what our input field is. We need to focus on the name as the name has to represent the field. So for the when we move over to the PHP we can use the name as a POST and create a string using the name attribute.</p>
<p>I hope your following so far if not, it will be come more obvious what I mean later in the tutorial.</p>
<div style="border:1px solid #fff;background:#ececec;font:tahoma;font-size:12px;">&lt;input name=&#8221;submit&#8221; type=&#8221;submit&#8221; value=&#8221;Submit&#8221; /&gt;</div>
<p>This code makes a very simple submit button. You can name it whatever you like using the Value=&#8221;" attribute.</p>
<p>Thats it for our contact form, lets move on to the serious stuff. PHP!</p>
<div style="border:1px solid #fff;background:#ececec;font:tahoma;font-size:12px;">&lt;?php<br />
$name = $_POST['name'];<br />
$email = $_POST['email'];<br />
$tel = $_POST['tel'];<br />
$comment = $_POST['comment'];</div>
<p>So We start with opening our PHP tag. We create our strings using the $_POST['']; Remember we used the method post on our form. Well the PHP is taking that POSTED information and defining it as a string in this case we will use the example $name = $_POST['name']; This code is pull the information posted in the name input field on our form. Another example is $email = $_POST['email'];will take the details posted in the input field from our form.</p>
<p>now on to the more important details on how to stop some basic spam getting through our forms. We will use the commonly know IF, IFELSE and ELSE statments for checking the fields for data.#</p>
<p>So our first line will be:</p>
<div style="border:1px solid #fff;background:#ececec;font:tahoma;font-size:12px;">if ($name == &#8220;&#8221; )</div>
<p>So were calling the $name String we made earlier and asking PHP IF the field $name is equal to blank using the == &#8220;&#8221;. This idicates to PHP if no data is entered in the name field of our form to do something about this.</p>
<div style="border:1px solid #fff;background:#ececec;font:tahoma;font-size:12px;">{<br />
echo &#8216;You must enter a name &lt;input type=button value=&#8221;Back&#8221; onClick=&#8221;history.go(-1)&#8221;&gt;&#8217;;<br />
}</div>
<p>Now what we have asked the IF statment to do is echo a message if nothing is entered in the name field on the form. Also we have added a button that takes the user back to the previous page.</p>
<p>So thats the simple statments we use to stop blank submissions of our forms and could have a very low effect on spam getting sent through.<br />
Now a very important thing to note is that we need to some more coding to check if an email is a real email address and not just some random text.</p>
<div style="border:1px solid #fff;background:#ececec;font:tahoma;font-size:12px;">elseif (!eregi(&#8221;^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$&#8221;, $email))<br />
{<br />
echo&#8217;not a valid email please enter a correct email address &lt;input type=button value=&#8221;Back&#8221; onClick=&#8221;history.go(-1)&#8221;&gt;&#8217;;<br />
}</div>
<p>Very useful as this checks that the email has the required 4 parts to it. the name that goes before the @. It checks that an @ is present. Checks for a domain such as @yahoo, and the final .com or .co.uk.<br />
Its that simple.<br />
the full code can be found below:</p>
<div style="border:1px solid #fff;background:#ececec;font:tahoma;font-size:12px;">&lt;?php<br />
$name = $_POST['name'];<br />
$email = $_POST['email'];<br />
$tel = $_POST['tel'];<br />
$comment = $_POST['comment'];<br />
$checkbox = $_POST['checkbox'];<br />
$checkbox1 = $_POST ['checkbox1'];if ($name == &#8220;&#8221; ) {<br />
echo &#8216;You must enter a name &lt;input onclick=&#8221;history.go(-1)&#8221; type=&#8221;button&#8221; value=&#8221;Back&#8221; /&gt;&#8217;;<br />
}<br />
elseif ($email == &#8220;&#8221;) {<br />
echo &#8216;You must enter a email &lt;input onclick=&#8221;history.go(-1)&#8221; type=&#8221;button&#8221; value=&#8221;Back&#8221; /&gt;&#8217;;<br />
}<br />
elseif ($checkbox1 == &#8220;&#8221;) {<br />
echo &#8216;You must accept our terms and conditions to send us a message &lt;input onclick=&#8221;history.go(-1)&#8221; type=&#8221;button&#8221; value=&#8221;Back&#8221; /&gt;&#8217;;<br />
}<br />
elseif ($comment == &#8220;&#8221;) {<br />
echo &#8216;You must enter a comment &lt;input onclick=&#8221;history.go(-1)&#8221; type=&#8221;button&#8221; value=&#8221;Back&#8221; /&gt;&#8217;;<br />
}<br />
elseif (!eregi(&#8221;^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$&#8221;, $email))<br />
{<br />
echo&#8217;not a valid email please enter a correct email address &lt;input onclick=&#8221;history.go(-1)&#8221; type=&#8221;button&#8221; value=&#8221;Back&#8221; /&gt;&#8217;;<br />
}<br />
else {<br />
echo &#8216;Form is valid and has been sent&#8217;;// you can use this section to send the mail to you or store in a database. I can provide code or help with this section if people require it.<br />
}<br />
?&gt;</div>
<p>As you can see the full code checks the important information and checks  if it is valid or not.<br />
***** Please note this is a very basic tutorial and in no way guarentees to reduce the amount of spam you recieve from your contact forms. But will reduce the amount of blank submissions caused by Bots.*****</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.digitalpark.co.uk/simple-php-form-validation-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE6 PNG Fix and CSS2.1 Validation</title>
		<link>http://blog.digitalpark.co.uk/ie6-png-fix-and-css2-1-validation/</link>
		<comments>http://blog.digitalpark.co.uk/ie6-png-fix-and-css2-1-validation/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 16:02:01 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Freeance]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[PNGFIX]]></category>
		<category><![CDATA[Validation]]></category>
		<category><![CDATA[web designer]]></category>
		<category><![CDATA[xHTML]]></category>

		<guid isPermaLink="false">http://blog.digitalpark.co.uk/?p=13</guid>
		<description><![CDATA[Images that use transparent backgrounds cause a problem for IE6 users as the .png file is not fully supported.
So as everything there is a fix. this fix comes in the shape of iepngfix.htc a file that manipulates what IE6 is seeing and makes the image background transparent as intended.
So what do you do to make [...]]]></description>
			<content:encoded><![CDATA[<p>Images that use transparent backgrounds cause a problem for IE6 users as the .png file is not fully supported.</p>
<p>So as everything there is a fix. this fix comes in the shape of iepngfix.htc a file that manipulates what IE6 is seeing and makes the image background transparent as intended.</p>
<p>So what do you do to make this work? well you download this file: <a href="http://www.twinhelix.com/css/iepngfix/iepngfix.zip">iepngfix.zip</a></p>
<p>okay now extract this folder. You need two key ingredients, one teh iepngfix.htc file ( comes in handy) and the blank.gif image. you upload these to the webspace you are hosting your website using ftp.</p>
<p>you dont need to modify these at all! just upload the files. One that is complete we then turn to your coding. At the top of the page in the header area you need to add:</p>
<p>img, div { behavior: url(iepngfix.htc) } within the css style tags. Okay now upload your file and test it out. How did you find it? better no big boxes around images that have transparent backgrounds? good thats what we are looking for.</p>
<p>Nice all sorted! But wait! test your CSS validation at <a href="http://jigsaw.w3.org/css-validator/">w3.org/css-validator/</a> damn it the code i told you to add is not valid. It will work fine in you external css file but it still wont be valid.</p>
<p>Heres what i added to the code to make it web standard compliant:<br />
//&lt;!&#8211;[if lte IE 6]&#8211;&gt;<br />
//&lt;style type=&#8221;text/css&#8221;&gt;<br />
// img, div { behavior: url(iepngfix.htc) }<br />
//&lt;/style&gt;<br />
//&lt;!&#8211;[endif]&#8212;&gt;</p>
<p>*** Please note to remove the // before adding to your code***</p>
<p>this validates the code as css level 2.1 compliant and only works when a user is browsing with IE6. Hopefully you have as much faith as i do in the public using more uptodate browsers like IE7 and Firefox 3 which identify the .png image as using a transparent background.</p>
<p>thanks for reading hope you found this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.digitalpark.co.uk/ie6-png-fix-and-css2-1-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Email Contact form with Database Intergration</title>
		<link>http://blog.digitalpark.co.uk/email-contact-form-with-database-intergration/</link>
		<comments>http://blog.digitalpark.co.uk/email-contact-form-with-database-intergration/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 15:53:38 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Database Intergration]]></category>
		<category><![CDATA[Email Contact Form]]></category>
		<category><![CDATA[email database]]></category>
		<category><![CDATA[freelance designer]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[xHTML]]></category>

		<guid isPermaLink="false">http://blog.digitalpark.co.uk/?p=9</guid>
		<description><![CDATA[Okay so we want to have a form that people can fill in, the form sends to both email account and stores in the database.
for this we need so field names. Im using Name, company, email address and Article. this is how we created our submit article form on AWDP but the database is an [...]]]></description>
			<content:encoded><![CDATA[<p>Okay so we want to have a form that people can fill in, the form sends to both email account and stores in the database.</p>
<p>for this we need so field names. Im using Name, company, email address and Article. this is how we created our submit article form on AWDP but the database is an extra feature.</p>
<p>first lets create a simple form(<strong>save this as submitform.html or what ever you want</strong>) :<br />
<code><br />
&lt;form name=”contact_form” action=”sendform.php” method=”post”&gt;<br />
&lt;table width=”530px” border=”0? cellspacing=”0? cellpadding=”0?&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;&lt;label&gt;Name&lt;/label&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;input type=”text” class=”text_input” name=”name” value=”" /&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;&lt;label&gt;Company Name&lt;/label&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;input type=”text” class=”text_input” name=”company” value=”" /&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;&lt;label&gt;Email Address&lt;/label&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;input type=”text” class=”text_input” name=”email” value=”" /&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td valign=”top”&gt;&lt;label&gt;Article&lt;/label&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;textarea name=”article” rows=”10? cols=”50?&gt;&lt;/textarea&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;&amp;nbsp;&lt;/td&gt;<br />
&lt;td&gt;&lt;input type=”submit” value=”Send” /&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;&lt;/form&gt;<br />
</code><br />
okay that should be easy to understand if you know a fair bit about HTML.</p>
<p>we need to connect to the database so we use this code:<br />
<code><br />
&lt;?php</code></p>
<p>$host= “localhost”;<br />
$dbuser =”your database username here”;<br />
$dbpass = “your database password here”;<br />
$dbname = “your database name here”;</p>
<p>$connection = mysql_connect($host, $dbuser, $dbpass) or die(mysql_error());<br />
mysql_select_db($dbname) or die(mysql_error());<br />
?&gt;</p>
<p><strong>save this as dbconnect.php</strong> we can call this file by using &lt;?php include ‘dbconnect.php’; ?&gt;</p>
<p>now we need to create the database:<br />
<code><br />
CREATE TABLE  `emails` (<br />
`ID` INT( 11 ) NOT NULL AUTO_INCREMENT ,<br />
`name` VARCHAR( 250 ) NOT NULL ,<br />
`company` VARCHAR( 250 ) NOT NULL ,<br />
`email` VARCHAR( 250 ) NOT NULL ,<br />
`article` TEXT NOT NULL ,<br />
PRIMARY KEY (  `ID` )<br />
) TYPE = MYISAM<br />
</code><br />
this will create our database so we can add information to this. What we need to do now is build our <strong>sendform.php</strong> file. This will be php based and use the include dbconnect file.<br />
<code><br />
&lt;?php</code></p>
<p>include ‘dbconnect.php’;</p>
<p>$name = $_POST['name'];</p>
<p>$email = $_POST['email'];</p>
<p>$article = $_POST['article'];</p>
<p>$company = $_POST['company'];</p>
<p>$telephone = $_POST['telephone'];</p>
<p>$mailmsg.= ‘Name: ‘ . $name . “\n”;<br />
$mailmsg.= ‘Email: ‘ . $email . “\n”;<br />
$mailmsg.= ‘Article: ‘ . $article . “\n”;<br />
$mailmsg.= ‘Company: ‘ . $company . “\n”;</p>
<p>?&gt;</p>
<p>okay so that was a little bit of php code that basically takes the information we had from the form and turns it in to a format we can read from the emails. using $mailmsg we can merge all the data entered and send it all together using this code (<strong>add to sendform.php</strong>):<br />
<code><br />
&lt;?php</code></p>
<p>$send=mail(’whoever@mydomain.com’,&#8217;Submission Form’, $mailmsg );</p>
<p>if($send){</p>
<p>echo ( “Thanks for contacting us $name We will reply as soon as possible” );</p>
<p>}</p>
<p>else{</p>
<p>echo ( “There was an error with your request” );</p>
<p>}</p>
<p>?&gt;</p>
<p>thats it that code will send to your email or it will return an error if there was a problem. lets work on intergrating to the database. We will do a simple insert into value.<br />
<code><br />
$query = mysql_query(”INSERT INTO emails (name, company, email, article) VALUES (’$name’,'$email’,'$company’, ‘$article’)”) or die(mysql_error());<br />
</code><br />
we want to add that to our other code above  so it will look some thing like this (<strong>sendform.php should now look like this</strong>):<br />
<code><br />
&lt;?php</code></p>
<p>include ‘dbconnect.php’;</p>
<p>$name = $_POST['name'];</p>
<p>$email = $_POST['email'];</p>
<p>$comments = $_POST['article'];</p>
<p>$company = $_POST['company'];</p>
<p>$mailmsg.= ‘Name: ‘ . $name . “\n”;<br />
$mailmsg.= ‘Email: ‘ . $email . “\n”;<br />
$mailmsg.= ‘Article: ‘ . $article . “\n”;<br />
$mailmsg.= ‘Company: ‘ . $company . “\n”;</p>
<p>$query = mysql_query(”INSERT INTO emails (name, company, email, article) VALUES (’$name’,&#8217;$email’,&#8217;$company’, ‘$article’)”) or die(mysql_error());</p>
<p>?&gt;</p>
<p>&lt;?php</p>
<p>$send=mail(’whoever@mydomain.com’,’Submission Form’, $mailmsg );</p>
<p>if($send){</p>
<p>echo ( “Thanks for contacting us $name We will reply as soon as possible” );</p>
<p>}</p>
<p>else{</p>
<p>echo ( “There was an error with your request” );</p>
<p>}</p>
<p>?&gt;</p>
<p>thats it! were done! so basically we insert the data entered from the form to the database and will send it to your email address.</p>
<p>if you want to pull all the queries in the database use this code ( <strong>save this as extract_details.php</strong>):</p>
<p>&lt;?php<br />
include ‘dbconnect.php’;</p>
<p>$id = $_GET['id'];</p>
<p>$query = “SELECT * FROM emails”;</p>
<p>$result = mysql_query($query) or die(mysql_error());</p>
<p>while ($row = mysql_fetch_array($result)) {</p>
<p>extract($row);<br />
}</p>
<p>?&gt;</p>
<p>&lt;? echo “$name, $company, $email, $article”; ?&gt;<a href="file:///D:/Documents%20and%20Settings/robertc/Desktop/awdp/one.php"><br />
</a></p>
<p>this will pull all the information in the database by using the ID and displays all the information.</p>
<p>Thanks for reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.digitalpark.co.uk/email-contact-form-with-database-intergration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
