<?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>israeljernigan.com &#187; PHP</title>
	<atom:link href="http://www.israeljernigan.com/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.israeljernigan.com</link>
	<description>personal web blogger</description>
	<lastBuildDate>Sat, 17 Oct 2009 16:28:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Learning resources</title>
		<link>http://www.israeljernigan.com/php-learning-resources</link>
		<comments>http://www.israeljernigan.com/php-learning-resources#comments</comments>
		<pubDate>Fri, 11 Jan 2008 15:35:57 +0000</pubDate>
		<dc:creator>Israel Jernigan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[learning]]></category>

		<guid isPermaLink="false">http://www.israeljernigan.com/php-learning-resources</guid>
		<description><![CDATA[There are a few resources for PHP that I feel have been vital in my learning the language. From books to websites, I will try and give a short grouping that will hopefully help you understand PHP better.
Books
Some of the best help books I&#8217;ve found are written by, Larry Ullman. Here is one of his [...]]]></description>
			<content:encoded><![CDATA[<p>There are a few resources for PHP that I feel have been vital in my learning the language. From books to websites, I will try and give a short grouping that will hopefully help you understand PHP better.</p>
<h3>Books</h3>
<p>Some of the best help books I&#8217;ve found are written by, Larry Ullman. Here is one of his best.</p>
<p>[asa personal_post]0321336577[/asa]</p>
<p>This was my first PHP book. It&#8217;s not the greatest book out there, but if you want full application examples this is the book for you.</p>
<p>[asa personal_post]0764579665[/asa]</p>
<p>This next book isn&#8217;t a PHP book, but it is a great resource for learning <a href="http://en.wikipedia.org/wiki/Mysql" target="_blank" title="Wikipedia.org link for MySQL">MySQL</a>. MySQL is free database component that works great with PHP.</p>
<p>[asa personal_post]0672327120[/asa]</p>
<h3>Website Links</h3>
<p>PHP <strong>cookies</strong> were something I didn&#8217;t learn from a book. Here are a few links that really helped me develop those skills. <a href="http://www.go4expert.com/forums/showthread.php?t=219" title="PHP and cookies tutorial" target="_blank">PHP and cookies</a>. <a href="http://us2.php.net/manual/en/function.setcookie.php" title="An amazing resource for everything PHP" target="_blank">PHP.net documentation</a>.</p>
<p><a href="http://www.webdesignforums.net/archive/index.php/t-21029.html" title="Great forum resource for PHP" target="_blank">Here is a great <strong>forum</strong></a>, not just for PHP, with lots of questions answered about PHP.</p>
<p>I wanted to learn about <strong>REGEXP</strong> in PHP, mostly for security verification. Here are two links that helped pave the way. <a href="http://www.jellyandcustard.com/2006/06/13/regular-expressions-in-php/" title="There are basic concepts and examples for REGEXP in PHP" target="_blank">The basics</a>. <a href="http://www.roscripts.com/PHP_regular_expressions_examples-136.html" title="Using custom functions to integrate REGEXP in PHP" target="_blank">More advanced methods</a>.</p>
<p>Just a great website with lots of PHP <a href="http://www.goodphptutorials.com/" title="A really good tutorial website" target="_blank">centered <strong>tutorials</strong></a>.</p>
<p><a href="http://www.php.net" title="You need to use this as a resource and for learning." target="_blank">PHP.net</a>. Just use it!</p>
<h3>Random Resources</h3>
<p>Just some <a href="http://www.reinholdweber.com/?p=3" title="Optimize and prioritize your PHP" target="_blank">good ideas to implement</a>.</p>
<p>Sometimes there are <a href="http://www.digital-web.com/" title="Try searching here for PHP" target="_blank">good articles at Digital-Web.com</a> about PHP.</p>
<p>You should at least <a href="http://passwordrobot.com/blog/5-htaccess-tricks-every-webmaster-should-know/" title="You never know when you might need to use this" target="_blank">check out</a> .htaccess.</p>
<p>Great <a href="http://www.alistapart.com/" title="Well written articles about alot of different things concerning the digital world." target="_blank">articles at alistapart.com</a> about alot of things, including php.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.israeljernigan.com/php-learning-resources/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using PHP to Easily Create Radio Lists and Drop Downs</title>
		<link>http://www.israeljernigan.com/using-php-to-easily-create-radio-lists-and-drop-downs</link>
		<comments>http://www.israeljernigan.com/using-php-to-easily-create-radio-lists-and-drop-downs#comments</comments>
		<pubDate>Mon, 22 Oct 2007 16:05:44 +0000</pubDate>
		<dc:creator>Israel Jernigan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[drop down]]></category>
		<category><![CDATA[php integration]]></category>
		<category><![CDATA[radio list]]></category>

		<guid isPermaLink="false">http://www.israeljernigan.com/using-php-to-easily-create-radio-lists-and-drop-downs</guid>
		<description><![CDATA[One thing that I find myself doing continuously is creating forms. From forms that submit info into a database, to forms that send emails. I constantly am doing repetitive processes.
Most of the time I am using server side PHP code to create or validate part of the form. So I created a few server side [...]]]></description>
			<content:encoded><![CDATA[<p>One thing that I find myself doing continuously is creating forms. From forms that submit info into a database, to forms that send emails. I constantly am doing repetitive processes.</p>
<p>Most of the time I am using server side PHP code to create or validate part of the form. So I created a few server side functions that I have found help my process along. Two things that I seem to need often are <strong>radio lists</strong> and <strong>drop down options</strong>.  I needed them to be as dynamic as possible. (To work with javascript, labels, css, validation, and database information)</p>
<p>I created two functions: one for radio buttons, and one for drop down options. I am going to list the entire functions and than explain the different aspects of them.<br />
<span id="more-15"></span></p>
<h3>Radio List Function</h3>
<pre>function Fradio($a,$name,$c=FALSE,$o=FALSE){
//a=array(array('v'=&gt;'value','l'=&gt;'label','o'=&gt;'extra/options/javascript'))
//name=radio form's name
//c=choice
//o=other values [true/false]  

$x=0;//the count

if(is_array($a)){

if(!$o){//if no individual options for each input field, like javascript

foreach($a as $v){

$x=$x+1;

$selected = ($c == $v['v']) ? 'checked="checked"' : '';  

$line .= ' &lt;label for="'.$name.$x.'"&gt;

&lt;input type="radio" name="'.$name.'" id="'.$name.$x.'" '.$selected.' value="'.$v['v'].'" /&gt;

'.$v['l'].'

&lt;/label&gt;';

}

}else{

foreach($a as $v){

$selected = ($c == $v['v']) ? 'checked="checked"' : '';

$line .= ' &lt;label for="'.$name.$x.'"&gt;

&lt;input type="radio" name="'.$name.'" id="'.$name.$x.'" '.$selected.' value="'.$v['v'].'" '.$v['o'].' /&gt;

'.$v['l'].'

&lt;/label&gt;';

}

}

return $line;

}

return false;

}</pre>
<h3>Drop Down Function</h3>
<pre>function Fdd($a,$name,$c=FALSE,$o=FALSE){
//a=array(array('v'=&gt;'value','l'=&gt;'label'))
//name=dropdown form's name
//c=choice
//o=other values [extra/options/javascript]  

if(is_array($a)){  

$line = '&lt;select id="'.$name.'" name="'.$name.'" '.$o.'&gt;';

foreach($a as $v){

$selected = ($c == $v['v']) ? 'selected="selected"' : '';

$line .= '&lt;option value="'.$v['v'].'" '.$selected.' &gt;'.$v['l'].'&lt;/option&gt;';

}

$line .= '&lt;/select&gt;';

return $line;

}

return false;

}</pre>
<p>They work using arrays of information, I thought this would be the best way for me to create data and cycle through it. I will start by showing you a basic array of information, and what basic information the functions require.</p>
<p>To make this easier to read I&#8217;ve separated each array(choice) into a variable. You can easily create this array from a mysql result set.</p>
<pre>$choice1 = array('v'=&gt;'value1','l'=&gt;'label1','o'=&gt;'option1');

$choice2 = array('v'=&gt;'value2','l'=&gt;'label2','o'=&gt;'option2');

$choice3 = array('v'=&gt;'value3','l'=&gt;'label3','o'=&gt;'option3');

$array = array($choice2,$choice2,$choice3);</pre>
<p>If you were trying to use mysql you could do something like this.</p>
<pre>while($row = mysql_fetch_row($resultset)){

$array[] = array('v'=&gt;$row["value"],'l'=&gt;$row["label"],'o'=&gt;$row["option"]);

}</pre>
<p>Than you can store your radio list in a variable or simply display the function.</p>
<pre>echo Fradio($array,'radioName','choice selected');</pre>
<p>Now there are four variables that can be passed into this function and two of them are required. From left to right they are this: the array containing the values for the form tag(required), the name being used for the form tag(required), the choice selected(can be used for cms, or error correction), and lastly set this to true if any extra options are to be used(rarely needed, but allows for the use of javascript).</p>
<p>Both functions use the same format except on one part. Because of the way drop downs work, you cannot use javascript on each individual option tag(it won&#8217;t work correctly in all browsers, and doesn&#8217;t validate). Instead you must use it on the select tag. For the drop down function, the variable isn&#8217;t a boolean value, it&#8217;s the actual javascript. There is no need to put it in the array like the radio function. The radio function accepts a boolean value for that variable, and you actually put the javascript in the array along with the other radio button info.</p>
<p>Both functions will return false if the first variable is not an array. If you would like to comment or make suggestions feel free to post below. Feel free to use this, and I hope it helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.israeljernigan.com/using-php-to-easily-create-radio-lists-and-drop-downs/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
