PHP Web Host - Quality Web Hosting For All PHP Applications Clan Themes! We make clans look good!!
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Darrell3831
Worker
Worker


Joined: Feb 18, 2004
Posts: 244

PostPosted: Fri Aug 20, 2004 12:56 pm Reply with quote Back to top

This is as much a straight HTML question as it is a PHP question.

I'm trying to create a drop down selectable list. Here is a snipit from a piece of working code that I've created.

Code:
echo "<td align=\"center\"><nobr><SELECT NAME=\"name\">";
         
         $rights = $db->sql_query("SELECT fid from ".$prefix."_university_rights WHERE cid='$cid'");
         $total_rights = $db->sql_numrows($rights);
         if($total_rights !=0) {
            while (list($fid) = $db->sql_fetchrow($rights)) {
               $faculty = $db->sql_query("SELECT name from ".$prefix."_university_faculty WHERE fid='$fid'");
               while (list($name) = $db->sql_fetchrow($faculty)) {
                  if (get_magic_quotes_gpc())
                     $name = stripslashes($name);
                  echo "<option value=\"$cid\">$name</option>";
               }
            }
            echo "<option value=\"$cid\">-------------------------</option>";
         } else {
         echo "<option value=\"$cid\">"._UNIVERSITY_UNASSIGNED."</option>";
         echo "<option value=\"$cid\">-------------------------</option>";
         }
      echo "</select></nobr></td>";


I can't seem to find a way to have all my select drop down boxes the same size. Unless I use the little cheater trick you see here.

Where I have the line of dashes. Those dashes hold the select box out to a minimum size. Never letting it get any smaller.

How do you use the Select tag in PHP and at the same time force the box to be a minimum size no matter what data you plan to fill it with?

BTW, that snipit up above cycles through several times filling a table with rows of drop down select fields...

Thanks,
Darrell
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Aug 24, 2004 6:07 am Reply with quote Back to top

Try this and let me know if this works
Code:
<select NAME="foo" WIDTH="300" STYLE="width: 300px">
    <option>one
    <option>two
    <option>three
</select>

There is also a maxwidth CSS attribute that might need to come into play.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Darrell3831
Worker
Worker


Joined: Feb 18, 2004
Posts: 244

PostPosted: Tue Aug 24, 2004 9:13 am Reply with quote Back to top

Yes!

It does work. The select box dosent shrink or grow depending on size. That's exactly what I was looking for.

Code:
<?php
echo "<select NAME=\"foo\" width=\"200\" style=\"width: 200px\" >"
   ."<option value=test>short</option>"
   ."<option value=test>longer</option>"
   ."<option value=test>longest</option>"
   ."<option value=test>this one is intentionally two long to fit</option></select>";
?>


I did look at the W3C Recommendation for select and option, but I did not see the width attribute. Sorry.

Only registered users can see links on this board!
Get registered or login to the forums!


Thanks,
Darrell
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Aug 24, 2004 9:15 am Reply with quote Back to top

The width attribute is only for NN4.x, I believe. The CSS is all that you should probably need now.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum