<?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>Kevin Pajak - Interactive Web Developer/Designer - BLOG &#187; PHP</title>
	<atom:link href="http://www.kevinpajak.com/blog/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kevinpajak.com/blog</link>
	<description>Creative visionary, digital entrepreneur.</description>
	<lastBuildDate>Tue, 13 Apr 2010 02:01:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to replace a backslash character in a string</title>
		<link>http://www.kevinpajak.com/blog/2010/02/12/how-to-replace-a-backslash-character-in-a-string/</link>
		<comments>http://www.kevinpajak.com/blog/2010/02/12/how-to-replace-a-backslash-character-in-a-string/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 08:36:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Dev/Design]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=363</guid>
		<description><![CDATA[Ah, so often it&#8217;s the little things eh&#8230; PROBLEM: I needed to find a way to &#8220;re-process&#8221; text a user enters for a live chat client I&#8217;m working on (in which I prevented MySQL database injections via the mysqli_real_escape_string function). The problem of course is that the text the user enters nicely protects you from [...]]]></description>
			<content:encoded><![CDATA[<p>Ah, so often it&#8217;s the little things eh&#8230;</p>
<p>PROBLEM: I needed to find a way to &#8220;re-process&#8221; text a user enters for a live chat client I&#8217;m working on (in which I prevented MySQL database injections via the <em>mysqli_real_escape_string</em> function). The problem of course is that the text the user enters nicely protects you from a MySQL database injection, BUT the text then comes back full of backslash (\) characters (not too cool looking huh). So, to remove these, you can use the following code (here, I use the PHP <em>str_replace</em> function:</p>
<p>// Convert escaped characters back to regular text<br />
$string = str_replace(&quot;\\&quot;, &quot;&quot;, $string);</p>
<p>Thanks to Geoff Muldoon for this one!:<br />
<A HREF="http://www.bigresource.com/Tracker/Track-php-OcMaOirM/" target="_blank"><B>How to replace a backslash character in a string?</B></A></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/02/12/how-to-replace-a-backslash-character-in-a-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Clearing contents of $_POST array values (to avoid re-submitting form data upon page refresh)</title>
		<link>http://www.kevinpajak.com/blog/2010/02/02/clearing-contents-of-_post-array-values-to-avoid-re-submitting-form-data-upon-page-refresh/</link>
		<comments>http://www.kevinpajak.com/blog/2010/02/02/clearing-contents-of-_post-array-values-to-avoid-re-submitting-form-data-upon-page-refresh/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 02:43:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Daily Journal]]></category>
		<category><![CDATA[Web Dev/Design]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=327</guid>
		<description><![CDATA[After trying SEVERAL different possible methods &#038; suggestions, I finally was able to achieve this by pointing my form&#8217;s PHP processing page to another page, rather than the same page itself (I really wanted to keep everything &#8211; form as well as form-handling all on the same page, but I found that I had to [...]]]></description>
			<content:encoded><![CDATA[<p>After trying SEVERAL different possible methods &#038; suggestions, I finally was able to achieve this by pointing my form&#8217;s PHP processing page to another page, rather than the same page itself (I really wanted to keep everything &#8211; form as well as form-handling all on the same page, but I found that I had to do this in order to prevent the user from re-submitting form data [through the contents of the $_POST array] that does not clear upon a user&#8217;s hitting the refresh button on the browser). And following that, I had my form&#8217;s processing page script then re-direct back to the original page where the form was located:</p>
<p>    // redirect to the same page without the POST data<br />
    header(&#8220;Location: original-page-with-form.php&#8221;);<br />
    die;</p>
<p>Here are some of the pages I consulted in my research:</p>
<p><A HREF="http://www.thefutureoftheweb.com/blog/get-redirect-after-post" target="_blank">http://www.thefutureoftheweb.com/blog/get-redirect-after-post</A><br />
<A HREF="http://www.issociate.de/board/post/171234/Clear_POST_variables_on_page_refresh.html" target="_blank">http://www.issociate.de/board/post/171234/Clear_POST_variables_on_page_refresh.html</A><br />
<A HREF="http://www.mail-archive.com/php-list@yahoogroups.com/msg04635.html" target="_blank">http://www.mail-archive.com/php-list@yahoogroups.com/msg04635.html</A><br />
<A HREF="http://qaix.com/php-web-programming/437-896-clear-post-variables-read.shtml" target="_blank">http://qaix.com/php-web-programming/437-896-clear-post-variables-read.shtml</A></p>
<p>*NOTE: Of course, keep in mind that any header(&#8220;Location: PAGE&#8221;); PHP code must be included BEFORE any contents are outputted on the page, otherwise you will get the lovely &#8220;Headers already sent&#8221; PHP error.</p>
<p>Hope this can help anyone else out there who may be struggling with the same issue <img src='http://www.kevinpajak.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/02/02/clearing-contents-of-_post-array-values-to-avoid-re-submitting-form-data-upon-page-refresh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
