<?
/*
$string: the deliniated string you wish to parse and place as an option in your SELECT statement
$delimiter: the delimiter you use to separated the fields in your string. Commas (,)
or Pipes (|) are common delimiters.
*/
Function select_parse($string, $delimiter) {
$options = split( "[$delimiter]+", $string );
for( $i = 0; $options[$i]; $i++ ) {
echo "<option> $options[$i]\n";
}
}
$strText = "One,Two,Three,Four";
?>
<FORM>
<SELECT NAME="test">
<? select_parse($strText, ","); ?>
</SELECT>
</FORM>
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP , PHP , HTML , PDF , Excel string justification align center text Categories : Strings , PHP , HTML and PHP Text Wrapping Categories : PHP , HTML and PHP , Strings Function to create a separated list Categories : PHP , Arrays , Strings How to know which input button of type image was pressed in a form with
multiple image buttons (_x and _y) in PHP? Categories : PHP , Variables , HTML How to preset a text string in a textarea input field Categories : HTML , HTML and PHP , PHP , Beginner Guides Making sure a string containes only digits or no digits. Categories : Strings , PHP , Regexps How to control the number of decimal places when outputting numbers. Categories : PHP , Strings , Variables How to use regular expressions to get the list of links from an HTML page Categories : PHP , Regexps , HTML , HTML and PHP Produces browser-safe strings while preserving HTML tags. Categories : Strings , HTTP , PHP , HTML and PHP How to get the source of a site into an array. Categories : Arrays , HTML , PHP BBCode Formatting String Categories : PHP , HTML , Regexps , Arrays Filter - A simple class that lets you use multiple functions to create custom filters. Categories : PHP , PHP Classes , Strings Paginator - a class that can help you to split MySQL database query result sets to pages. Categories : MySQL , Databases , HTML , PHP Browser Detecor Class Categories : PHP Classes , PHP , HTML