Re: Need some help folks....

From: Date: Wed, 29 Nov 2000 00:23:40 +0000
Subject: Re: Need some help folks....
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-27724@lists.php.net to get a copy of this message
I just thought of another way ... while(list($key,$val) = each($array)) { $foo = explode('_',$key); $type = $foo[0]; $$type[] = '<a href="link.html">'.$key.'</a>'; } Much pretier and in the end you'll have an array called $retail, etc. and you can then just do an implode :O) --Joe On Wed, Nov 29, 2000 at 05:48:37AM -0800, Dallas Kropka wrote: > Thanks, to all who wrote to help.... In the end it was Joe Stump who did the > most good. > > Just so you know there Michael... A 2D array wont work with the rest of the > code... but this is how I got it.... > > function display_cat() > { > $section; > > > for($j=1 ; $j< count($this->cat_arr); $j++) > { > > echo"<tr>"; > > > > for ($i=1 ; $i<3 ; $i++) > { > list($key, $value) = each($this->cat_arr); > $foo = explode('_',$key); > > if($foo[0] != $section) > { > $section = $foo[0]; > switch($section) > { > case "online": > echo "</tr><tr><td colspan =2><BR><font > face=\"Arial, Helvetica, > sans-serif\" color=\"#003366\" size=\"5\">Onlne > Business<HR></font></td></tr><tr>"; > break; > case "rent": > echo "</tr><tr><td colspan =2><BR><font > face=\"Arial, Helvetica, > sans-serif\" color=\"#003366\" size=\"5\">Rental > Stores<HR></font></td></tr><tr>"; > break; > case "retail": > echo "</tr><tr><td colspan =2><BR><font > face=\"Arial, Helvetica, > sans-serif\" color=\"#003366\" size=\"5\">Retail > Stores<HR></font></td></tr><tr>"; > break; > case "food": > echo "</tr><tr><td colspan =2><BR><font > face=\"Arial, Helvetica, > sans-serif\" color=\"#003366\" size=\"5\">Food > Industry<HR></font></td></tr><tr>"; > break; > case "serv": > echo "</tr><tr><td colspan =2><BR><font > face=\"Arial, Helvetica, > sans-serif\" color=\"#003366\" size=\"5\">Service > Industry<HR></font></td></tr><tr>"; > break; > case "man": > echo "</tr><tr><td colspan =2><BR><font > face=\"Arial, Helvetica, > sans-serif\" color=\"#003366\" > > size=\"5\">Manufacturing<HR></font></td></tr><tr>"; > break; > case "fin": > echo "</tr><tr><td colspan =2><BR><font > face=\"Arial, Helvetica, > sans-serif\" color=\"#003366\" size=\"5\">Financial > Services<HR></font></td></tr><tr>"; > break; > case "trans": > echo "</tr><tr><td colspan =2><BR><font > face=\"Arial, Helvetica, > sans-serif\" color=\"#003366\" > > size=\"5\">Transportation<HR></font></td></tr><tr>"; > break; > case "other": > echo "</tr><tr><td colspan =2><BR><font > face=\"Arial, Helvetica, > sans-serif\" color=\"#003366\" size=\"5\">Other > Categories<HR></font></td></tr><tr>"; > break; > default: > break; > } > } > > $link = "combo.php3?category=".$key; > echo("<td><a href=\"$link\" ><font face=\"Arial\" > color=\"#003366\" > size=\"3\"> $value</font></a></td>"); > } > > echo"</tr>"; > > } > > > Its ugly in outlook, but it works great. > > > > > > > > > ----- Original Message ----- > From: "Michael Dearman" <mdearman@inficad.com> > To: "Dallas Kropka" <dallask@firstworld.net> > Cc: "PHP LIST" <php-general@lists.php.net> > Sent: Tuesday, November 28, 2000 4:12 PM > Subject: Re: [PHP] Need some help folks.... > > > > > > > > Dallas Kropka wrote: > > > > > > Thanks for the quick response Joe, but there is a problem with this.... > each > > > key is different in regards to the latter half of the key.... here is > the > > > whole array..... > > > > > > > Would arranging it into a 2d array help? > > > > $cat_arr= array( "online" => array ("online" => "Online > > Business "), > > "rent" => array ("auto" > > =>"Automobile / Boat > Rentals ", > > "construction" =>"Construction > Equipment", > > etc), > > "retail" => array ("antique" > > =>"Antique", > > "appliance" =>"Appliance", > > etc), > > > > Mike D. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net ================================================================================ = Joe Stump joestump98@yahoo.com http://www.miester.org = ================================================================================ Need a programmer? http://www.google.com/search?q=joe+stump+resume

« previous php.general (#27724) next »