PDA

View Full Version : Creating setting for listbox


veenuisthebest
02-27-2009, 02:17 AM
Hello,

I want to create a textarea setting for my product in which I will enter few categories that I want to be displayed in a listbox/combobox in my script.

I can't seem to find an article over this one.

Thanks

1Unreal
02-27-2009, 04:01 AM
So you want to have a textarea and whatever it typed into that to be displayed in a drop down box?

You could do something like this assuming each catagory is displayed in the textarea line by line:


//Data from textarea
$data = $_POST['textarea'];

//Seperate out the data
$data = explode("n\", $data);

//Start the option field
echo '<select>';

//Put each line into the option of a drop down menu
foreach($data as $d){
echo '<option>'.$d.'</option>';
}
//end the option field
echo '</select>';


Is that what you mean?