Wrapping text inside a select menu

From: Date: Fri, 07 Jul 2000 20:54:29 +0000
Subject: Wrapping text inside a select menu
Groups: php.general 
Request: Send a blank email to php-general+get-5454@lists.php.net to get a copy of this message
Thanks that worked wonderfully! However, I have another problem. I'm making another select menu, but this time you can only select one and not multiple, that prints out all the book id's and book titles. The problem I am having is that some of these book titles are rather long (100+ characters) and it is making my select box wider than my screen, so I am having to scroll left to right to view the whole title. My question: How do I "wrap" the title in the select box so it is not on one long line? I have it set in my <textarea> tag to wrap="hard" and wrap="physical" when I enter the information. When I grab it back out to print out the new select menu I str_replace("\n", "<br>", $string). However, this doesn't "wrap" the titles in the select menu. Any ideas how I could do this? Thanks, jay -----Original Message----- From: Matthew Leverton [mailto:matthew@aeroinc.net] Sent: Friday, July 07, 2000 3:19 PM To: Paulson, Joseph V. "Jay"; php-general@lists.php.net Subject: Re: [PHP] passing multiple vars? Quite simple actually. PHP handles it the most gracefully out of all the languages I've used. <select name="bookids[]" multiple> <option></option> ... </select> This will pass an array to php. You can use something like this to loop through: for ($i=0; $i<sizeof($bookids); $i++) { // bookids[$i]; } Or you could dump the array into a comma dilimited string and use something like: "DELETE FROM Books WHERE Book_ID IN ($comma_list)" (That may not be the exact SQL, but something along those lines.) Check up on the array functions in the manual for more info, or email me and I can be more specific. -- Matthew Leverton - matthew@aeroinc.net - http://www.allegro.cc -----Original Message----- From: Paulson, Joseph V. "Jay" <jay.paulson@viatel.com> To: php-general@lists.php.net <php-general@lists.php.net> Date: Friday, July 07, 2000 3:13 PM Subject: [PHP] passing multiple vars? >Hello everyone-- > >Okay well I have a slight problem. I have a database of books with the >fields of: > >Book_ID >Title >Description > >What I am trying to do is be able to delete multiple entries at the same >time. I have my SQL statement print out all the book id's and book titles >in a multiple select menu in the browser and then I press the "Delete Book" >button at the bottom of the page. > >Here's the problem: how do I retireve all the book id's that I have selected >from the previous page? After I press the "Delete Book" button it only >passes one of the book id's instead of multiple id's. I really want to use >the <select><option> tags and not something like checkboxes because I don't >want hundreds of book titles printed to the screen and have the user scroll >down a huge page to check the boxes of which books he/she wants to delete. > >Anyway, any ideas on how I can pass all the values that I select on to the >next page? > >Here's a snippet of the form code I am using: > >echo "<select name=\"bookID\" size=\"10\" multiple>\n"; >for ($i=0; $i<$maxArraySize; $i++) { > echo "<option > value=\"".$book["BOOK_ID"][$i]."\">".$book["TITLE"][$i])." ></option>\n"; > } //end of for >echo "</select>\n"; > >thanks, >jay > >-- >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

« previous php.general (#5454) next »