<?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: PHP: Drop Down List with Select</title>
	<atom:link href="http://www.kavoir.com/2009/02/php-drop-down-list.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.kavoir.com/2009/02/php-drop-down-list.html</link>
	<description>Just another dumbass webmaster, goofing around...</description>
	<lastBuildDate>Wed, 08 Feb 2012 09:57:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: John</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-16370</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 28 Dec 2011 08:31:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-16370</guid>
		<description>Hi,

I am new to PHP and tried the following which did not work.
Can you explain why ?

&lt;?php

function generateSelect($name = &#039;&#039;, $options = array())
	{
	$html = &#039;&#039;;
	foreach ($options as $option =&gt; $value) 
	
	{$html .= &#039;&#039;.$option.&#039;&#039;;}
	
	$html .= &#039;&#039;;
	return $html;
	}

$companies = array(
	&#039;Microsoft&#039; =&gt; 1,
	&#039;Google&#039; =&gt; 2,
	&#039;Apple&#039; =&gt; 3);


$html = generateSelect(&#039;company&#039;, $companies);

?&gt;</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am new to PHP and tried the following which did not work.<br />
Can you explain why ?</p>
<p>&lt;?php</p>
<p>function generateSelect($name = &#039;&#039;, $options = array())<br />
	{<br />
	$html = &#039;&#8217;;<br />
	foreach ($options as $option =&gt; $value) </p>
<p>	{$html .= &#8221;.$option.&#8221;;}</p>
<p>	$html .= &#8221;;<br />
	return $html;<br />
	}</p>
<p>$companies = array(<br />
	&#8216;Microsoft&#8217; =&gt; 1,<br />
	&#8216;Google&#8217; =&gt; 2,<br />
	&#8216;Apple&#8217; =&gt; 3);</p>
<p>$html = generateSelect(&#8216;company&#8217;, $companies);</p>
<p>?&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Desmond Fernanda</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-15745</link>
		<dc:creator>Desmond Fernanda</dc:creator>
		<pubDate>Thu, 17 Nov 2011 03:58:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-15745</guid>
		<description>I have little share about dropdownlist changed when another dropdownlist selected. Follow this link :
http://roshanbh.com.np/2007/12/change-dropdown-list-options-values-from-database-with-ajax-and-php.html

or you can download the source : http://www.roshanbh.com.np/ajax_php_dropdown.zip

Thanks to Roshan&#039;s Blog :)

it&#039;s so help...</description>
		<content:encoded><![CDATA[<p>I have little share about dropdownlist changed when another dropdownlist selected. Follow this link :<br />
<a href="http://roshanbh.com.np/2007/12/change-dropdown-list-options-values-from-database-with-ajax-and-php.html" rel="nofollow">http://roshanbh.com.np/2007/12/change-dropdown-list-options-values-from-database-with-ajax-and-php.html</a></p>
<p>or you can download the source : <a href="http://www.roshanbh.com.np/ajax_php_dropdown.zip" rel="nofollow">http://www.roshanbh.com.np/ajax_php_dropdown.zip</a></p>
<p>Thanks to Roshan&#8217;s Blog :)</p>
<p>it&#8217;s so help&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dev</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-15506</link>
		<dc:creator>Dev</dc:creator>
		<pubDate>Mon, 22 Aug 2011 14:07:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-15506</guid>
		<description>how can we make dynamic drop down list like fist select country name then automatic comes state name in state drop down list. Please reply me on my email address</description>
		<content:encoded><![CDATA[<p>how can we make dynamic drop down list like fist select country name then automatic comes state name in state drop down list. Please reply me on my email address</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Anthony</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-15503</link>
		<dc:creator>Mark Anthony</dc:creator>
		<pubDate>Fri, 19 Aug 2011 00:13:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-15503</guid>
		<description>I am trying to develop a system where a user can edit his or her listed property.That means extracting the information back, update it and resubmit it..But my problem is that i have not been able to retrieve the information that where posted from a dropdown menu..Could you assist me on this??</description>
		<content:encoded><![CDATA[<p>I am trying to develop a system where a user can edit his or her listed property.That means extracting the information back, update it and resubmit it..But my problem is that i have not been able to retrieve the information that where posted from a dropdown menu..Could you assist me on this??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ash</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-15471</link>
		<dc:creator>Ash</dc:creator>
		<pubDate>Wed, 27 Jul 2011 09:11:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-15471</guid>
		<description>Please let me know too because I also want to do that.

When selecting a Category, Products of that selected category show in next drop down.

Please anyone..help
e-mail: enragedash@gmail.com
please please please !</description>
		<content:encoded><![CDATA[<p>Please let me know too because I also want to do that.</p>
<p>When selecting a Category, Products of that selected category show in next drop down.</p>
<p>Please anyone..help<br />
e-mail: <a href="mailto:enragedash@gmail.com">enragedash@gmail.com</a><br />
please please please !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JHPArizona</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-15192</link>
		<dc:creator>JHPArizona</dc:creator>
		<pubDate>Mon, 23 May 2011 04:16:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-15192</guid>
		<description>Essentially you would use php to query the data base.
Example of Connection:
    // create connection
        $MySQLserver = &quot;localhost&quot;;//the server of the MySQL (ie, localhost)
        $username = $_POST[&#039;username&#039;];  //the username for the DB (ie, root, web, whatever)
        $password = htmlspecialchars($_POST[&#039;password&#039;]); //the password for that username
        $DBname = $_POST[&#039;DBname&#039;];
        $connection = mysql_connect(&quot;$MySQLserver&quot;,&quot;$username&quot;,&quot;$password&quot;);
 // select database
        // change DBname to the DB that you are using
    $db = mysql_select_db(&quot;$DBname&quot;, $connection);
    // create SQL statement
   // you will need to create the select statement
$sql = &quot;select .......&quot;
// submit the select statement
 $sql_result = mysql_query($sql,$connection);

//get results you want to add to the select array
//there are lots of ways to do this but this is just one way
foreach($sql_result as $keynumber =&gt; $keyvalue)
{
  // we are going to store the data in a string and then convert to array
 $mydata .= $mydata + $keyvalue[&#039;column name&#039;]+&#039;#&#039;;
}
$companies = preg_split(&#039;#&#039;,$mydata);
And then you would just pass $companies as in the posted example.</description>
		<content:encoded><![CDATA[<p>Essentially you would use php to query the data base.<br />
Example of Connection:<br />
    // create connection<br />
        $MySQLserver = &#8220;localhost&#8221;;//the server of the MySQL (ie, localhost)<br />
        $username = $_POST['username'];  //the username for the DB (ie, root, web, whatever)<br />
        $password = htmlspecialchars($_POST['password']); //the password for that username<br />
        $DBname = $_POST['DBname'];<br />
        $connection = mysql_connect(&#8220;$MySQLserver&#8221;,&#8221;$username&#8221;,&#8221;$password&#8221;);<br />
 // select database<br />
        // change DBname to the DB that you are using<br />
    $db = mysql_select_db(&#8220;$DBname&#8221;, $connection);<br />
    // create SQL statement<br />
   // you will need to create the select statement<br />
$sql = &#8220;select &#8230;&#8230;.&#8221;<br />
// submit the select statement<br />
 $sql_result = mysql_query($sql,$connection);</p>
<p>//get results you want to add to the select array<br />
//there are lots of ways to do this but this is just one way<br />
foreach($sql_result as $keynumber =&gt; $keyvalue)<br />
{<br />
  // we are going to store the data in a string and then convert to array<br />
 $mydata .= $mydata + $keyvalue['column name']+&#8217;#';<br />
}<br />
$companies = preg_split(&#8216;#&#8217;,$mydata);<br />
And then you would just pass $companies as in the posted example.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-15184</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Wed, 18 May 2011 18:23:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-15184</guid>
		<description>I tried to modify your function to minimize user interaction and select the appropriate department (based on referrer) from the list. When doing so, it selects the appropriate option, then each option thereafter... Any thoughts?

 
function generateSelect($name = &#039;&#039;, $options = array(), $selected) {
	$html = &#039;&#039;.&quot;\n&quot;;
	foreach ($options as $option =&gt; $value) {
		if($selected==$value){$select=&#039;selected=&quot;selected&quot;&#039;;}
		$html .= &#039;&#039;.$option.&#039;&#039;.&quot;\n&quot;;
	}

	$html .= &#039;&#039;.&quot;\n&quot;;
	return $html;
}</description>
		<content:encoded><![CDATA[<p>I tried to modify your function to minimize user interaction and select the appropriate department (based on referrer) from the list. When doing so, it selects the appropriate option, then each option thereafter&#8230; Any thoughts?</p>
<p>function generateSelect($name = &#8221;, $options = array(), $selected) {<br />
	$html = &#8221;.&#8221;\n&#8221;;<br />
	foreach ($options as $option =&gt; $value) {<br />
		if($selected==$value){$select=&#8217;selected=&#8221;selected&#8221;&#8216;;}<br />
		$html .= &#8221;.$option.&#8221;.&#8221;\n&#8221;;<br />
	}</p>
<p>	$html .= &#8221;.&#8221;\n&#8221;;<br />
	return $html;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-14839</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 16 Apr 2011 13:33:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-14839</guid>
		<description>How would you generate a drop down when you don&#039;t know whtat the choices are(i.e. getting the choices from a table via mysql_query and then putting those values into an array</description>
		<content:encoded><![CDATA[<p>How would you generate a drop down when you don&#8217;t know whtat the choices are(i.e. getting the choices from a table via mysql_query and then putting those values into an array</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohammad Ajmal</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-14183</link>
		<dc:creator>Mohammad Ajmal</dc:creator>
		<pubDate>Sat, 29 Jan 2011 12:00:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-14183</guid>
		<description>Good Evening Sir,
                            This is Mohammad Ajmal, from Hyderabad, INDIA, I need one guidence from you if you will do that so my work will be easy so please guide me and I will be very thanksfull of you.
                             I want to create a programe of Dropdown list in HTML, In that what I want, in first drop down list I want to select class from 1st to 5th, if I will select 1st class from dropdown list so I want the dropdownlist of 1st class students names list below first dropdown list but if I will select 2nd class so I want 2nd class students names list.
                            So please guide me with your experience. I am waiting for your reply.
                                                                                    Thanks and Regards
                                                                                     MOHAMMAD AJMAL</description>
		<content:encoded><![CDATA[<p>Good Evening Sir,<br />
                            This is Mohammad Ajmal, from Hyderabad, INDIA, I need one guidence from you if you will do that so my work will be easy so please guide me and I will be very thanksfull of you.<br />
                             I want to create a programe of Dropdown list in HTML, In that what I want, in first drop down list I want to select class from 1st to 5th, if I will select 1st class from dropdown list so I want the dropdownlist of 1st class students names list below first dropdown list but if I will select 2nd class so I want 2nd class students names list.<br />
                            So please guide me with your experience. I am waiting for your reply.<br />
                                                                                    Thanks and Regards<br />
                                                                                     MOHAMMAD AJMAL</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andrea</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-14177</link>
		<dc:creator>andrea</dc:creator>
		<pubDate>Thu, 27 Jan 2011 21:53:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-14177</guid>
		<description>Hiya!

I am trying to use a drop down list to select a page to include depending on the option, so it is: out of the option list of &quot;Mine&quot;, &quot;his&quot; &quot;its&quot;, i would like that when i select &quot;Mine&quot; from drop down list it uses 
include=(&quot;myflie.php&quot;); 
although if i choose &quot;his&quot;, then it includes his.php
include =(&quot;his.php&quot;);

is this possible?

thanks guys!
andrea</description>
		<content:encoded><![CDATA[<p>Hiya!</p>
<p>I am trying to use a drop down list to select a page to include depending on the option, so it is: out of the option list of &#8220;Mine&#8221;, &#8220;his&#8221; &#8220;its&#8221;, i would like that when i select &#8220;Mine&#8221; from drop down list it uses<br />
include=(&#8220;myflie.php&#8221;);<br />
although if i choose &#8220;his&#8221;, then it includes his.php<br />
include =(&#8220;his.php&#8221;);</p>
<p>is this possible?</p>
<p>thanks guys!<br />
andrea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mathew Jose</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-13866</link>
		<dc:creator>Mathew Jose</dc:creator>
		<pubDate>Tue, 21 Dec 2010 08:02:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-13866</guid>
		<description>Hello

I have create some forms on PHP. Now I want to put them as a drop down one page, such as when i click on documents I must have a drop down of all the forms that I did, so that I can choose from there the form that I need. Please help.</description>
		<content:encoded><![CDATA[<p>Hello</p>
<p>I have create some forms on PHP. Now I want to put them as a drop down one page, such as when i click on documents I must have a drop down of all the forms that I did, so that I can choose from there the form that I need. Please help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seasons</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-11193</link>
		<dc:creator>Seasons</dc:creator>
		<pubDate>Sat, 30 Oct 2010 13:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-11193</guid>
		<description>You you could change the blog subject title PHP: Drop Down List with Select to  more specific for your webpage you write. I liked the the writing yet.</description>
		<content:encoded><![CDATA[<p>You you could change the blog subject title PHP: Drop Down List with Select to  more specific for your webpage you write. I liked the the writing yet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Freddy</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-10822</link>
		<dc:creator>Freddy</dc:creator>
		<pubDate>Wed, 01 Sep 2010 22:27:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-10822</guid>
		<description>Useless tutorial for beginners when you don&#039;t bother to show a &quot;complete&quot; preview on how it should be done.

Beginners has no way to understand what you mean by
&quot;$html = generateSelect(&#039;company&#039;, $companies);&quot;</description>
		<content:encoded><![CDATA[<p>Useless tutorial for beginners when you don&#8217;t bother to show a &#8220;complete&#8221; preview on how it should be done.</p>
<p>Beginners has no way to understand what you mean by<br />
&#8220;$html = generateSelect(&#8216;company&#8217;, $companies);&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phil</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-10010</link>
		<dc:creator>phil</dc:creator>
		<pubDate>Sat, 12 Jun 2010 20:47:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-10010</guid>
		<description>$companies = array(
	&#039;Microsoft&#039; =&gt; 1,
	&#039;Google&#039; =&gt; 2,
	&#039;Apple&#039; =&gt; 3
);

Using your example, is it possible to have this drop down list, for example, load up with &#039;Apple&#039; (option #3) being PRE-selected?</description>
		<content:encoded><![CDATA[<p>$companies = array(<br />
	&#8216;Microsoft&#8217; =&gt; 1,<br />
	&#8216;Google&#8217; =&gt; 2,<br />
	&#8216;Apple&#8217; =&gt; 3<br />
);</p>
<p>Using your example, is it possible to have this drop down list, for example, load up with &#8216;Apple&#8217; (option #3) being PRE-selected?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeybee</title>
		<link>http://www.kavoir.com/2009/02/php-drop-down-list.html/comment-page-1#comment-9843</link>
		<dc:creator>jeybee</dc:creator>
		<pubDate>Fri, 30 Apr 2010 04:12:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/02/php-drop-down-list.html#comment-9843</guid>
		<description>hi i&#039;m new in doing php right now, i have my first task, there is already an existing program but what i need to revise is a drop down just like the comment of sucipto in this thread, the difference is that for example when the user select registered, the next text box will be enable for the input of registration NO., if he chose as not registered then the textbox will be disabled.Thank you for  your help and will be highly appreciated.</description>
		<content:encoded><![CDATA[<p>hi i&#8217;m new in doing php right now, i have my first task, there is already an existing program but what i need to revise is a drop down just like the comment of sucipto in this thread, the difference is that for example when the user select registered, the next text box will be enable for the input of registration NO., if he chose as not registered then the textbox will be disabled.Thank you for  your help and will be highly appreciated.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

