<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Populating a Select Box With PHP and MySQL &#8211; PHP Tutorial</title>
	<atom:link href="http://www.tech-evangelist.com/2007/11/22/php-select-box/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tech-evangelist.com/2007/11/22/php-select-box/</link>
	<description>Technical Articles, Musings and Opinions from Tech-Evangelist</description>
	<lastBuildDate>Wed, 21 Jul 2010 17:18:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<item>
		<title>By: frezya</title>
		<link>http://www.tech-evangelist.com/2007/11/22/php-select-box/comment-page-1/#comment-12913</link>
		<dc:creator>frezya</dc:creator>
		<pubDate>Wed, 30 Jun 2010 20:01:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/11/22/php-select-box/#comment-12913</guid>
		<description>GREAT! 
Thanks a lot! I solved php problem...</description>
		<content:encoded><![CDATA[<p>GREAT!<br />
Thanks a lot! I solved php problem&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doogie</title>
		<link>http://www.tech-evangelist.com/2007/11/22/php-select-box/comment-page-1/#comment-12790</link>
		<dc:creator>Doogie</dc:creator>
		<pubDate>Thu, 20 May 2010 23:43:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/11/22/php-select-box/#comment-12790</guid>
		<description>I have not tested it, but mysql_fetch_array is generally believed to be faster than mysql_fetch_object because the latter is theoretically more resource intensive.  However, the official PHP site says that the performance is identical. 

http://php.net/manual/en/function.mysql-fetch-object.php</description>
		<content:encoded><![CDATA[<p>I have not tested it, but mysql_fetch_array is generally believed to be faster than mysql_fetch_object because the latter is theoretically more resource intensive.  However, the official PHP site says that the performance is identical. </p>
<p><a href="http://php.net/manual/en/function.mysql-fetch-object.php" rel="nofollow">http://php.net/manual/en/function.mysql-fetch-object.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ebud</title>
		<link>http://www.tech-evangelist.com/2007/11/22/php-select-box/comment-page-1/#comment-12788</link>
		<dc:creator>ebud</dc:creator>
		<pubDate>Thu, 20 May 2010 20:11:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/11/22/php-select-box/#comment-12788</guid>
		<description>Any advantage to using:
while($row = mysql_fetch_array($rs))

vs
while ($row = mysql_fetch_object($rs))</description>
		<content:encoded><![CDATA[<p>Any advantage to using:<br />
while($row = mysql_fetch_array($rs))</p>
<p>vs<br />
while ($row = mysql_fetch_object($rs))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doogie</title>
		<link>http://www.tech-evangelist.com/2007/11/22/php-select-box/comment-page-1/#comment-12366</link>
		<dc:creator>Doogie</dc:creator>
		<pubDate>Fri, 15 Jan 2010 14:29:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/11/22/php-select-box/#comment-12366</guid>
		<description>We do plan to do a series of PHP tutorials regarding forms processing.  It is all a matter of finding the time to do it. We each have regular jobs that get in the way. :D

Keep checking back and we will get them done sooner of later.</description>
		<content:encoded><![CDATA[<p>We do plan to do a series of PHP tutorials regarding forms processing.  It is all a matter of finding the time to do it. We each have regular jobs that get in the way. <img src='http://www.tech-evangelist.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Keep checking back and we will get them done sooner of later.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lunar Dust</title>
		<link>http://www.tech-evangelist.com/2007/11/22/php-select-box/comment-page-1/#comment-12353</link>
		<dc:creator>lunar Dust</dc:creator>
		<pubDate>Wed, 13 Jan 2010 17:31:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/11/22/php-select-box/#comment-12353</guid>
		<description>nice one... awesome, to-the-point tutorial yet with plenty of handy explanation.

Wish you could do another tutorial which sort of processes the value selected in the select box using php.

thanks</description>
		<content:encoded><![CDATA[<p>nice one&#8230; awesome, to-the-point tutorial yet with plenty of handy explanation.</p>
<p>Wish you could do another tutorial which sort of processes the value selected in the select box using php.</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cafunfa</title>
		<link>http://www.tech-evangelist.com/2007/11/22/php-select-box/comment-page-1/#comment-12027</link>
		<dc:creator>Cafunfa</dc:creator>
		<pubDate>Thu, 19 Nov 2009 01:19:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/11/22/php-select-box/#comment-12027</guid>
		<description>GREAT! Exactly what i&#039;m looking for!
Thanks a lot!</description>
		<content:encoded><![CDATA[<p>GREAT! Exactly what i&#8217;m looking for!<br />
Thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doogie</title>
		<link>http://www.tech-evangelist.com/2007/11/22/php-select-box/comment-page-1/#comment-11965</link>
		<dc:creator>Doogie</dc:creator>
		<pubDate>Sat, 14 Nov 2009 18:55:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/11/22/php-select-box/#comment-11965</guid>
		<description>Hi Patrick

There isn&#039;t any way to save the information if someone makes a selection and then simply refreshes the form, because no value has been stored anywhere. Sometimes a browser will cache the data, but each browser works a little differntly. If you have a state code already stored in a table or you are passing the value from one form to the next, it is easy to show which state was selected. 

First, we need to have the state code stored and passed to a variable. I am going to call the variable $stateCode.

Second, let&#039;s assume that the column names for your state code and state name are state_code and state_name. 

Third, modify the code above and change the echo statement to the following. 
  
  echo &quot;&lt;option value=\&quot;&quot;.$row[&#039;state_code&#039;].&quot;\&quot;&quot;;  
  if ($stateCode == $row[&#039;state_code&#039;]) echo &quot; selected=\&quot;selected\&quot;&quot;;
  echo &quot;&gt;&quot;.$row[&#039;state_name&#039;].&quot;\n&quot;;
  
This will not work unless you have a value assigned to $stateCode.  In order for a stored value to show as &quot;selected&quot;, the option statement must include the &quot;selected&quot; attribute.</description>
		<content:encoded><![CDATA[<p>Hi Patrick</p>
<p>There isn&#8217;t any way to save the information if someone makes a selection and then simply refreshes the form, because no value has been stored anywhere. Sometimes a browser will cache the data, but each browser works a little differntly. If you have a state code already stored in a table or you are passing the value from one form to the next, it is easy to show which state was selected. </p>
<p>First, we need to have the state code stored and passed to a variable. I am going to call the variable $stateCode.</p>
<p>Second, let&#8217;s assume that the column names for your state code and state name are state_code and state_name. </p>
<p>Third, modify the code above and change the echo statement to the following. </p>
<p>  echo &quot;&lt;option value=\&quot;&quot;.$row['state_code'].&quot;\&quot;&quot;;<br />
  if ($stateCode == $row['state_code']) echo &quot; selected=\&quot;selected\&quot;&quot;;<br />
  echo &quot;&gt;&quot;.$row['state_name'].&quot;\n&quot;;</p>
<p>This will not work unless you have a value assigned to $stateCode.  In order for a stored value to show as &#8220;selected&#8221;, the option statement must include the &#8220;selected&#8221; attribute.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.tech-evangelist.com/2007/11/22/php-select-box/comment-page-1/#comment-11964</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Sat, 14 Nov 2009 15:47:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/11/22/php-select-box/#comment-11964</guid>
		<description>My problem is a little different. I have a select box with the states all filled in. If the page is refreshed the select box reverts to the first item in the list. How do I retain the selected index and display it after a refresh?</description>
		<content:encoded><![CDATA[<p>My problem is a little different. I have a select box with the states all filled in. If the page is refreshed the select box reverts to the first item in the list. How do I retain the selected index and display it after a refresh?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KK</title>
		<link>http://www.tech-evangelist.com/2007/11/22/php-select-box/comment-page-1/#comment-10464</link>
		<dc:creator>KK</dc:creator>
		<pubDate>Wed, 04 Mar 2009 03:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/11/22/php-select-box/#comment-10464</guid>
		<description>This code is awesome.. exactly what i was looking for! Got it up and running in no time at all. 

Thank you very much! :)</description>
		<content:encoded><![CDATA[<p>This code is awesome.. exactly what i was looking for! Got it up and running in no time at all. </p>
<p>Thank you very much! <img src='http://www.tech-evangelist.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Syd</title>
		<link>http://www.tech-evangelist.com/2007/11/22/php-select-box/comment-page-1/#comment-10226</link>
		<dc:creator>Syd</dc:creator>
		<pubDate>Wed, 31 Dec 2008 20:40:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.tech-evangelist.com/2007/11/22/php-select-box/#comment-10226</guid>
		<description>Many thanks - Have spent an age looking for a well explained simple example.</description>
		<content:encoded><![CDATA[<p>Many thanks &#8211; Have spent an age looking for a well explained simple example.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
