<?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>PHP Magic Book - Free PHP Scripts, Tutorials and Downloads &#187; essentials</title>
	<atom:link href="http://www.phpmagicbook.com/tag/essentials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpmagicbook.com</link>
	<description>PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips</description>
	<lastBuildDate>Tue, 15 Jun 2010 13:22:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PHP Script Not Working &#8211; Solution</title>
		<link>http://www.phpmagicbook.com/php-script-not-working-solution/</link>
		<comments>http://www.phpmagicbook.com/php-script-not-working-solution/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 11:52:52 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Post & Get]]></category>
		<category><![CDATA[essentials]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[troubleshoot]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=435</guid>
		<description><![CDATA[Ever wondered that most of the PHP scripts you download, do not do anything. I mean you downloaded the PHP script, uploaded at your host or copied at localhost and when you run it, it will not display results. In most cases it happens. One reason might be that the script is not properly written. [...]<p><a href="http://www.phpmagicbook.com/php-script-not-working-solution/">PHP Script Not Working &#8211; Solution</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Ever wondered that most of the PHP scripts you download, do not do anything. I mean you downloaded the PHP script, uploaded at your host or copied at localhost and when you run it, it will not display results. In most cases it happens. One reason might be that the script is not properly written. But the fact is, scripts are written correctly in most cases. The problem is that the developers miss something very important in most cases. Next time you download scripts, those should run if you follow this instruction I am going to tell you.</p>
<p><span id="more-435"></span></p>
<p>Some PHP developers write code with <strong>Globals On</strong>. </p>
<p>Left click wamp icon -> <strong>config files -> php.ini</strong></p>
<p>When its open, search for <strong>register_globals</strong></p>
<p>These must be Off by default e.g.<br />
<strong>register_globals = Off</strong></p>
<p>Many developers were used to program in environment of On Globals. This makes programming easier but this method is vulnerable and security risk. You do not have to get variables which you post at the new page where PHP does something in case of Globals On. Sometimes developers still do the same thing.</p>
<p>This is not recommended.</p>
<p><strong>Globals should be off in PHP.ini and scripts should work while Globals are off.</strong></p>
<p>So the reason is obvious. Many scripts you download, you will see do not get variables when these are posted. Those are programmed in environment of Globals On (Easy way PHP Coding).</p>
<p>Next time you download a script and if that is not working, check that Variables are being requested after when these are posted or not.</p>
<h4>What to Do</h4>
<p>Suppose someone posts a form with his <strong>name</strong> and <strong>email</strong> with variables <strong>txtName</strong> and <strong>txtEmail</strong> which are text input names. txtName and txtEmail should be requested at the next PHP page. If these are not being called, then you will get Null result which will be empty.</p>
<p>Request these variables in the following manner at the next page at the top of everything where PHP code starts. In case of above example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$txtName</span><span style="color: #339933;">=</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;txtName&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$txtEmail</span><span style="color: #339933;">=</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;txtEmail&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now $txtName contains the name of user and $txtEmail contains the email and you can use these further. When some PHP script is not working, always see that if these variables are being requested by this manner at the next page? If not you can get every variable like this and the script will be working in most cases. You can also use $_Post instead of $_REQUEST.</p>
<p>Another reason is not using proper PHP starting tag.</p>
<h4>Wrong Tag</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span></pre></div></div>

<h4>Correct Usage of PHP Tag</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></pre></div></div>

<p>Some servers will output errors if you do not use proper PHP starting tag.</p>
<p>Also read <a href="http://www.phpmagicbook.com/php-post-and-get/">Post and Get</a> if this is not clear.</p>
<p><a href="http://www.phpmagicbook.com/php-script-not-working-solution/">PHP Script Not Working &#8211; Solution</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/date-difference-in-php-find-date-difference/" title="Date Difference In PHP &#8211; Find Date Difference">Date Difference In PHP &#8211; Find Date Difference</a></li><li><a href="http://www.phpmagicbook.com/insert-adsense-after-the-first-post-in-your-wordpress-blog/" title="Insert Adsense After the First Post in Your WordPress Blog">Insert Adsense After the First Post in Your WordPress Blog</a></li><li><a href="http://www.phpmagicbook.com/php-while-loop/" title="PHP While Loop">PHP While Loop</a></li><li><a href="http://www.phpmagicbook.com/date-object-for-future-or-past-easy-monthwise-or-datewise-records-selection/" title="Date Object For Future or Past &#8211; Easy Monthwise or Datewise Records Selection Using PHP">Date Object For Future or Past &#8211; Easy Monthwise or Datewise Records Selection Using PHP</a></li><li><a href="http://www.phpmagicbook.com/display-how-many-post-have-been-published-today-at-your-blog/" title="Display How Many Post Have Been Published Today at Your Blog">Display How Many Post Have Been Published Today at Your Blog</a></li><li><a href="http://www.phpmagicbook.com/confirm-form-variables-post-before-script-execution/" title="Confirm Form Variables Post Before Script Execution">Confirm Form Variables Post Before Script Execution</a></li><li><a href="http://www.phpmagicbook.com/dynamic-random-number/" title="Dynamic Random Number Generation Using PHP">Dynamic Random Number Generation Using PHP</a></li><li><a href="http://www.phpmagicbook.com/function-existence-check/" title="Function Existence Check Using PHP">Function Existence Check Using PHP</a></li><li><a href="http://www.phpmagicbook.com/print/" title="Print in PHP">Print in PHP</a></li><li><a href="http://www.phpmagicbook.com/browser-check-with-php/" title="Browser Check With PHP">Browser Check With PHP</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/php-script-not-working-solution/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
