<?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>Pyrocam.com &#187; php</title>
	<atom:link href="http://pyrocam.com/tag/php-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://pyrocam.com</link>
	<description>I&#039;m like Vitamins for Computers</description>
	<lastBuildDate>Wed, 09 May 2012 07:29:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Simple PHP quiz</title>
		<link>http://pyrocam.com/simple-php-quiz/</link>
		<comments>http://pyrocam.com/simple-php-quiz/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 16:29:41 +0000</pubDate>
		<dc:creator>pyrocam</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[quiz]]></category>
		<category><![CDATA[radio buttons]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://pyrocam.com/?page_id=56</guid>
		<description><![CDATA[ContentsMake your own online quiz with PHP easilyMake your own online quiz with PHP easily Disclaimer: All care No Responsibility. you follow the instructions provided at your own risk. I take no responsibility any damage you may cause. Please read the article in full before starting I thought it would be fun to make a [...]]]></description>
			<content:encoded><![CDATA[<div class="mwm-aal-container"><div class='mwm-aal-title'>Contents</div><ol><li><a href="#Make+your+own+online+quiz+with+PHP+easily">Make your own online quiz with PHP easily</a></li></ol></div><a name="Make+your+own+online+quiz+with+PHP+easily"></a><h2><strong>Make your own online quiz with PHP easily</strong></h2>
<p><em>Disclaimer: All care No Responsibility. you follow the instructions provided at your own risk. I take no responsibility any damage you may cause. Please read the article in full before starting </em></p>
<p>I thought it would be fun to make a little quiz the other day and it  was pretty simple, so I thought I would share it.<br />
Basically, using post, if / else and some radio buttons you can make a  simple quiz that looks good and is pretty easy to create and update.<br />
the quiz runs in a single page, so first thing I do is to see if the  quiz has already been taken by checking a post variable specifically for  this purpose.</p>
<p><code>?php</code><code><br />
if($_POST['done'] != 1 )<br />
{</code><code>?;</code><br />
so now I know its not a completed quiz, so I start asking questions. for  the purpose of this I am going to only use 2 questions.<br />
I am going to open up a form, posting to the same page and then use  radio buttons to set individual variables which I have called opvar2 and  opvar1</p>
<p><code> form action="quiz.php" method="post" /;</code><code><br />
Do you use a terminal?</code><code><br />
input type="radio" name="opvar1" value="1"; Yes</code><code><br />
input type="radio" name="opvar1" value="0"; No</code></p>
<p><code><br />
how many domains do you manage?<br />
</code><code> input type="radio" name="opvar2" value="0"; I don't <img src='http://pyrocam.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </code><code><br />
input type="radio" name="opvar2" value="1"; 1</code><code><br />
input type="radio" name="opvar2" value="2"; 2</code><code><br />
input type="radio" name="opvar2" value="3"; 3</code><code><br />
input type="radio" name="opvar2" value="4"; 4</code><code><br />
input type="radio" name="opvar2" value="5"; 5 or more</code></p>
<p>OK so we have two variables opvar2 and opvar1 with corresponding values  eg, &#8217;2&#8242; and &#8217;4&#8242; we need to close this form off and give it a submit  button but we add in one more variable so we can identify whether or not  this page has been submitted or not.</p>
<p><code>input type="hidden" name="done" value="1"/;<br />
</code><code>input type="submit" value="Submit...."/;</code><br />
<code> /form;</code><br />
All the questions are primed and ready to go, pressing the submit button  will refresh the page posting the results to itself. So now we need to  look at that and do something with it!</p>
<p><code> ?php<br />
</code><code>} else {</code><br />
<code>$lopvar2=$_POST['opvar2'];</code><code><br />
$lopvar1=$_POST['opvar1'];</code></p>
<p><code>$total = $lopvar2 + $lopvar1;</code><code><br />
print $total;</code><code><br />
}</code><code><br />
?;</code><code> </code></p>
<p>So if the page is returning stuff in post, we go straight down to this  last ELSE statement, pickup the variables and add them, for now it just  posts them plainly but later I will demonstrate how to use a &#8216;if / else&#8217;  statement to get some nicer results!</p>
<p><a href="http://www.pyrocam.com/files/quiz.php">Here is the full quiz I  made</a></p>
<p><a href="http://www.pyrocam.com/files/quiz.txt">And its source code </a></p>
]]></content:encoded>
			<wfw:commentRss>http://pyrocam.com/simple-php-quiz/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Simple PHP webcomic code</title>
		<link>http://pyrocam.com/simple-php-webcomic-code/</link>
		<comments>http://pyrocam.com/simple-php-webcomic-code/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 16:29:02 +0000</pubDate>
		<dc:creator>pyrocam</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[comic titles]]></category>
		<category><![CDATA[comics]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[mysql database]]></category>
		<category><![CDATA[mysql query]]></category>
		<category><![CDATA[mysql table]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[webcomic]]></category>

		<guid isPermaLink="false">http://pyrocam.com/?page_id=54</guid>
		<description><![CDATA[Disclaimer: All care No Responsibility. you follow the instructions provided at your own risk. I take no responsibility any damage you may cause. Please read the article in full before starting I have worked on the Life of Riley comic code for a while and realised its a good base for anyone else to use [...]]]></description>
			<content:encoded><![CDATA[<p><em>Disclaimer: All care No Responsibility. you follow the instructions provided at your own risk. I take no responsibility any damage you may cause. Please read the article in full before starting </em></p>
<p>I have worked on the <a href="http://www.pyrocam.com/life-of-riley">Life  of Riley</a> comic code for a while and realised its a good base for  anyone else to use for their own webcomic. its really simple and should  be easy enough to modify to suit your webcomic with some simple HTML  stuff.</p>
<p><a href="http://sourceforge.net/projects/rscc/" target="_blank">Here it  is on sourceforge</a></p>
<p>Here it is to <a href="http://www.pyrocam.com/files/comic.php.txt">download  now</a></p>
<p>I have added on this version to include a basic mysql table to pull the  titles out since they were not printed on the images, I recommend you  print the comic titles (if you are naming them) on the images but if  thats not feasible then here is the additional code to pull from a mysql  database. it should be quite straightforward. I feed the request the  $titleid which comes from the URL eg /comic.php?strip=1<br />
<code> mysql_connect('<strong>localhost or mysql.yourdomain.com</strong>','<strong>yourusername</strong>','<strong>yourpassword</strong>');</code><code><br />
@mysql_select_db('<strong>databasename</strong>') or die( "err1");</code></p>
<p><code> $query="SELECT * FROM titles";</code><code><br />
$result=mysql_query($query); </code><code><br />
</code><code> $title=mysql_result($result,$titleid,"title");<br />
</code><code><br />
</code><code> mysql_close();</code></p>
<p>Here is an <a onclick="window.open('files/titles.sql.txt','title.sql','scrollbars=yes,resizable=yes,width=400,height=800,left='+(screen.availWidth/2-200)+',top='+(screen.availHeight/2-400)+'');return  false;" href="http://www.pyrocam.com/files/titles.sql.txt" target="_blank">SQL file of the table</a> to get you started</p>
<p>The only major flaw is currently you need to update the end # of the  comics if your comics list is dynamic, mine is static so it doesnt need  to change.  a simple way of doing this could be instead of</p>
<p><span style="text-decoration: underline;">comic.php</span></p>
<p><code>$lastcomic = "100";</code></p>
<p>create a new file called end.php which you update as you go</p>
<p><span style="text-decoration: underline;">comic.php<br />
</span><br />
<code>//</code><code>$lastcomic = "100"; commented out not useing this  anymore<br />
</code><code>@include end.php;</code></p>
<p><span style="text-decoration: underline;">end.php</span></p>
<p><code>$lastcomic = "616";</code></p>
<p>And now you can edit that end.php as you update. It would be much  smarter to use Mysql for this as it would be a really simple call to  find out the end but I wanted this comic to be flat and not to require  SQL</p>
]]></content:encoded>
			<wfw:commentRss>http://pyrocam.com/simple-php-webcomic-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

