hi to all

pls help me to store whatever the user enters in text box in a table and then get the records from the table and use it in drop down list.
Any idea or tutorial to do like tat....

9 Years
Discussion Span
Last Post by Will Gresham

This will really depend on whether you can restrict what the user enters into the textarea. You need to decide where you will expect a new item (newline, comma-seperated, space seperated...) and then make sure the user follows the system, but people are known for not reading instructions.

Anyway, the below code should give you some idea of where to start (it is based on new values being on a newline):

// Get the data from the textarea and remove HTML entities
$textarea = htmlspecialchars($_POST['textarea_name']);

// Split the string up into an array of values
$dropdown_data = explode("\r\n", $textarea);

// Do some database stuff here.

// Output a dropdown
echo '<select name="dropdown_list">';
foreach($dropdown_data as $key => $value) {
  echo '<option value="'.$key.'">'.$value.'</option>';
echo '</select>';

That will need adjustments for what you want to do, but it should give you some idea.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.