select option

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I want to load textarea's value in drop-down box.
In first page, such form is existed.

<form name="form1" method="post" action="next.php">
    <textarea name="dayList" Id = "dayList" cols=20

in text area there's one column of values.

in "next.php", put values of 'dayList' in select option. I made a code
by myself. However, as you see, it's just nonsense. How can I modify
this? Thank you!


    <select name="dateList" id="dateList" >
              echo '<option value="1">'  .$value  '</option>';

Re: select option

kirke wrote:
Quoted text here. Click to load it

$_POST['dayList'] is a list of lines, not an int!
You want to convert a group of lines into an array.

    $value = explode("\n", $_POST['dayList']);

Quoted text here. Click to load it

    <select name="dateList" id="dateList">
    foreach ($value as $k=>$v) {
      echo '<option value="', $k, '">', $v, '</option>';

File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

Site Timeline