<?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 Advertising, Marketing &#038; Design</description>
	<lastBuildDate>Wed, 18 Aug 2010 11:10:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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 (&#8216;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.</p>
<p><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$phone</span> = <a href="http://www.php.net/ereg_replace"><span style="color: #000066;">ereg_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'[^0-9]'</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'phone'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!filter_var<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$phone</span>, FILTER_VALIDATE_REGEXP, <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'options'</span> =&gt; <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'regexp'</span> =&gt; <span style="color: #ff0000;">&quot;/^0[1-9][0-9]{8,9}$/&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Please enter your phone number correctly'</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div></li></ol></div></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&#40;INPUT_POST, 'email', FILTER_VALIDATE_EMAIL&#41;; 
Thats [...]]]></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><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$email</span> = filter_input<span style="color: #66cc66;">&#40;</span>INPUT_POST, <span style="color: #ff0000;">'email'</span>, FILTER_VALIDATE_EMAIL<span style="color: #66cc66;">&#41;</span>; </div></li></ol></div></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>
