<?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>SECOND SIGHTING &#187; PHP</title>
	<atom:link href="http://www.secondsighting.co.uk/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.secondsighting.co.uk</link>
	<description>Web Design, SEO &#38; PPC</description>
	<lastBuildDate>Fri, 03 Feb 2012 14:14:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>301 Redirect PHP</title>
		<link>http://www.secondsighting.co.uk/2012/01/23/301-redirect-php/</link>
		<comments>http://www.secondsighting.co.uk/2012/01/23/301-redirect-php/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 11:43:10 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[redirect]]></category>

		<guid isPermaLink="false">http://www.secondsighting.co.uk/?p=132</guid>
		<description><![CDATA[How to do a 301 redirect in PHP. Remember to add right at the top of your code, before anything is sent to the browser. &#60;?php header( "HTTP/1.1 301 Moved Permanently" ); header( "Location: http://www.secondsighting.co.uk" ); ?&#62; This tells the visitor&#8217;s browser, and any search engine that visits the page, that it has moved permanently [...]]]></description>
			<content:encoded><![CDATA[<p>How to do a 301 redirect in PHP. Remember to add right at the top of your code, before anything is sent to the browser.</p>
<p><code>&lt;?php<br />
header( "HTTP/1.1 301 Moved Permanently" );<br />
header( "Location: http://www.secondsighting.co.uk" );<br />
?&gt; </code></p>
<p>This tells the visitor&rsquo;s browser, and any search engine that visits the page, that it has moved <strong>permanently</strong> to the specified URL.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.secondsighting.co.uk/2012/01/23/301-redirect-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending HTTP Post Data Without Using a Form</title>
		<link>http://www.secondsighting.co.uk/2008/05/09/sending-http-post-data-without-using-a-form/</link>
		<comments>http://www.secondsighting.co.uk/2008/05/09/sending-http-post-data-without-using-a-form/#comments</comments>
		<pubDate>Fri, 09 May 2008 11:51:50 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[fsockopen]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[post]]></category>

		<guid isPermaLink="false">http://www.secondsighting.co.uk/2008/05/09/sending-http-post-data-without-using-a-form/</guid>
		<description><![CDATA[I always forget how to do this and it&#8217;s really useful&#8230; http://www.faqts.com/knowledge_base/view.phtml/aid/12039/fid/51]]></description>
			<content:encoded><![CDATA[<p>I always forget how to do this and it&#8217;s really useful&#8230; <a href="http://www.faqts.com/knowledge_base/view.phtml/aid/12039/fid/51" title="Sending HTTP post data without using a form">http://www.faqts.com/knowledge_base/view.phtml/aid/12039/fid/51</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.secondsighting.co.uk/2008/05/09/sending-http-post-data-without-using-a-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Stored Values With Select Elements</title>
		<link>http://www.secondsighting.co.uk/2008/01/09/using-stored-values-with-select-elements/</link>
		<comments>http://www.secondsighting.co.uk/2008/01/09/using-stored-values-with-select-elements/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 17:02:18 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[find & replace]]></category>
		<category><![CDATA[option]]></category>
		<category><![CDATA[pattern matching]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[select]]></category>
		<category><![CDATA[tag]]></category>

		<guid isPermaLink="false">http://www.secondsighting.co.uk/2008/01/09/using-stored-values-with-select-elements/</guid>
		<description><![CDATA[Heres how to use regular expressions to transform a plain HTML select element into one that autoselects based on a previous choice. You could use this to retrieve a value from a database and automatically select the correct option in a dropdown menu. The select element in the example below is called occupation and it [...]]]></description>
			<content:encoded><![CDATA[<p>Heres how to use <a href="http://en.wikipedia.org/wiki/Regular_expression" title="Regular expressions" target="_blank">regular expressions</a> to transform a plain HTML select element into one that autoselects based on a previous choice. You could use this to retrieve a value from a database and automatically select the correct option in a dropdown menu. The select element in the example below is called <em>occupation</em> and it is stored in an array called <em>$user_data</em>.</p>
<p>search for:</p>
<p>&lt;option value=&#8221;(.*)&#8221;&gt;.*&lt;/option&gt;</p>
<p>replace with:</p>
<p>&lt;option value=&#8221;$1&#8243;&lt;?php if ($user_data['occupation'] == &#8220;$1&#8243;) { echo &#8216; selected=&#8221;selected&#8221;&#8216;; } ?&gt;&gt;$1&lt;/option&gt;</p>
<p>Make sure to rename the fields accordingly for your situation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.secondsighting.co.uk/2008/01/09/using-stored-values-with-select-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple UK Phone Number Validation</title>
		<link>http://www.secondsighting.co.uk/2007/08/02/simple-uk-phone-number-validation/</link>
		<comments>http://www.secondsighting.co.uk/2007/08/02/simple-uk-phone-number-validation/#comments</comments>
		<pubDate>Thu, 02 Aug 2007 16:33:11 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.secondsighting.co.uk/2007/08/02/simple-uk-phone-number-validation/</guid>
		<description><![CDATA[This is a simple solution which should help a lot with accidental errors, but it&#8217;s still very easy for someone to enter a fake number if they want to. The first line of code removes anything thats not a number from a submitted post variable called &#8216;phone&#8217;. The second line checks the number begins with [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple solution which should help a lot with accidental errors, but it&#8217;s still very easy for someone to enter a fake number if they want to. The first line of code removes anything thats not a number from a submitted post variable called &#8216;phone&#8217;. The second line checks the number begins with a 0, followed by 1-9 (&#8217;00&#8242; is not allowed as it&#8217;s the UK dialling prefix for international calls), followed by 8 or 9 other digits. The example below works with PHP 5.2.0 &amp; above.<br />
<code><br />
$phone = ereg_replace('[^0-9]', '', $_POST['phone']);<br />
if (!filter_var($phone, FILTER_VALIDATE_REGEXP, array('options' =&gt; array('regexp' =&gt; "/^0[1-9][0-9]{8,9}$/")))) {<br />
echo 'Please enter your phone number correctly';<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.secondsighting.co.uk/2007/08/02/simple-uk-phone-number-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Email Validation</title>
		<link>http://www.secondsighting.co.uk/2007/07/03/simple-email-validation/</link>
		<comments>http://www.secondsighting.co.uk/2007/07/03/simple-email-validation/#comments</comments>
		<pubDate>Tue, 03 Jul 2007 22:22:49 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.secondsighting.co.uk/2007/07/03/simple-email-validation/</guid>
		<description><![CDATA[Starting with PHP 5.2.0 there is a really easy way to validate email addresses &#8211; namely the filter_input function. The example below takes a submitted POST variable called &#8216;email&#8217;, validates it against the email format, and returns FALSE if the filter fails or the value of the variable on success. $email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL); [...]]]></description>
			<content:encoded><![CDATA[<p>Starting with PHP 5.2.0 there is a really easy way to validate email addresses &#8211; namely the filter_input function. The example below takes a submitted POST variable called &#8216;email&#8217;, validates it against the email format, and returns FALSE if the filter fails or the value of the variable on success.</p>
<p><code>$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);</code></p>
<p>Thats all there is to it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.secondsighting.co.uk/2007/07/03/simple-email-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

