<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1022028" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1022028</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/array-type-issue#comment-1135779</link>
    <description> &lt;p&gt;update: figuring someone was going to ask how the test file handles the $months array internal to the include file i decided to modify and try it. works fine.&lt;/p&gt;
&lt;p&gt;i was begining to think it was an issue with the array in the function call. hat i needed to call it $array[] but that&#039;s obviously not the case, so what the hell is goingon here?&lt;/p&gt;
&lt;p&gt;edit:&lt;br /&gt;
update:&lt;/p&gt;
&lt;p&gt;the pages are called by functions so that i can have an if/elseif block to find which is approriate. as soon as i added an include lin in the function it worked.&lt;br /&gt;
obviously the problem was where they were being declared&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 21:25:11 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135779 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/array-type-issue#comment-1135775</link>
    <description> &lt;p&gt;well. i know it works because i was calling it from a test file to test it initially. this is the testfile:&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;include(\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;/home/joshua/includes/fyd.incs.php\&quot;); # includes file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$month&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;month&#039;];&lt;br /&gt;if(!isset(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$month&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;)){&lt;br /&gt;&amp;nbsp; echo &amp;lt;&amp;lt;&amp;lt;END&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;form action=\&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;PHP_SELF&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;\&quot; method=\&quot;POST\&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;input type=\&quot;text\&quot; name=\&quot;month\&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;input type=\&quot;submit\&quot; value=\&quot;check\&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/form&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;br /&gt;END;&lt;br /&gt;}else{&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$array&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=array(&#039;00&#039;=&amp;gt;&#039;Month&#039;, &#039;01&#039;=&amp;gt;&#039;January&#039;, &#039;02&#039;=&amp;gt;&#039;February&#039;,&lt;br /&gt; &#039;03&#039;=&amp;gt;&#039;March&#039;, &#039;04&#039;=&amp;gt;&#039;April&#039;, &#039;05&#039;=&amp;gt;&#039;May&#039;,&lt;br /&gt; &#039;06&#039;=&amp;gt;&#039;June&#039;, &#039;07&#039;=&amp;gt;&#039;July&#039;, &#039;08&#039;=&amp;gt;&#039;August&#039;,&lt;br /&gt; &#039;09&#039;=&amp;gt;&#039;September&#039;, &#039;10&#039;=&amp;gt;&#039;October&#039;, &#039;11&#039;=&amp;gt;&#039;November&#039;,&lt;br /&gt; &#039;12&#039;=&amp;gt;&#039;December&#039;);&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$selected&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;month&#039;];&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$list&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=array_to_options(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$array&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;month&#039;]);&lt;br /&gt;&amp;nbsp; echo &#039;&amp;lt;select name=\&quot;test\&quot; size=\&quot;1\&quot;&amp;gt;&#039;.&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$list&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;.&#039;&amp;lt;/select&amp;gt;&#039;;&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;note: the testfile NEVER genereated an error of ANY kind&lt;/p&gt;
&lt;p&gt;NOTE 2: THE ARRAYS ARE DEFINED BELOW THE FUNCTION IN THE SAME FILE, THUS IF THE FUNCTION IS BEING INCLUDED, SO ARE THEY, AND TWO OF THEM ARE IN THE INITAL POST. THE CALLS IN THE TWO FILES THAT USE THEM ARE LIKE THIS: $eyecoloroptlist=array_to_options($eyecolor, $_POST[&#039;eye&#039;]);&lt;/p&gt;
&lt;p&gt;note 3: edited to stop horizontal scroll&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 20:29:34 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135775 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/array-type-issue#comment-1135772</link>
    <description> &lt;p&gt;I see nothing wrong with your function.&lt;/p&gt;
&lt;p&gt;The only cause for the error you&#039;re getting (that I&#039;ve seen), is that the variable passed to the foreach() call is not an array.&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;array_to_options&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$array&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$selected&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;){&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$optlist&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;# make an empty string&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;print_r&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$array&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);exit;&lt;br /&gt;&amp;nbsp; foreach(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$array &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;as &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$selected&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;){ &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;# if this is the first time it wont match, so we don&#039;t need to care if it&#039;s set&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$optlist&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$optlist&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;.\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;&amp;lt;option value=\\&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot; selected&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&amp;lt;/option&amp;gt;\&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }else{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$optlist&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$optlist&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;.\&quot;&amp;lt;option value=\\&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&amp;lt;/option&amp;gt;\&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; return &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$optlist&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;;&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 20:19:12 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1135772 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/array-type-issue#comment-1135767</link>
    <description> &lt;p&gt;Have you checked that the function is getting the array information?&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 19:39:31 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1135767 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/array-type-issue#comment-1135765</link>
    <description> &lt;p&gt;line numbers are moot because the file is huge and i&#039;m merely giving you the function where the error occurs. the exact line is the that starts the foreach call.&lt;/p&gt;
&lt;p&gt;i showed you two of the arrays. ALL the arrays used are sett up the same way.&lt;/p&gt;
&lt;p&gt;edit: shane, have you looked at this???&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://us4.php.net/manual/en/control-structures.foreach.php&quot; class=&quot;bb-url&quot;&gt;http://us4.php.net/manual/en/control-structures.foreach.php&lt;/a&gt;&lt;br /&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;Quote: PHP 4 (not PHP 3) includes a foreach construct, much like Perl and some other languages. This simply gives an easy way to iterate over arrays. foreach works only on arrays, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variables. There are two syntaxes; the second is a minor but useful extension of the first: &lt;/blockquote&gt;&lt;/p&gt;
&lt;p&gt;foreach(array_expression as $value) statement&lt;br /&gt;
foreach(array_expression as $key =&amp;gt; $value) statement&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 19:10:54 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135765 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/array-type-issue#comment-1135760</link>
    <description> &lt;p&gt;Not seeing much wrong, but maybe your passing is not coming through properly.&lt;/p&gt;
&lt;p&gt;Perhaps echo the array out to test it is an array, or use the is_array() function to test it.&lt;/p&gt;
&lt;p&gt;I would suggest &lt;a href=&quot;http://www.pastebin.com&quot; class=&quot;bb-url&quot;&gt;pastebin.com&lt;/a&gt; so we can see the whole script file with line numbers.&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 18:29:24 +0000</pubDate>
 <dc:creator>ShaneS</dc:creator>
 <guid isPermaLink="false">comment 1135760 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
