[Ilugc] PHP Form Entries: Multi Select and Textarea

  • From: suraj@xxxxxxxxxxx (Suraj)
  • Date: Tue Sep 28 19:35:48 2004

Ankit Malhotra wrote: 
,----
| I would like to know  how to handle multiple select entries correctly.
| Is there no way i can avoid them from being over written. Theni have
`----

You can use an array for the name. ex:

<select name=choices[] multiple>
<option value=1>a</option>
<option value=2>b</option>
...
</select>

Now you will get all the selected values across in your PHP code.

,----
| variable number of sent in check boxes. The whole problem is that the
`----

Same with Checkboxes. Use name=choices[].  Of course, you will have to
dynamically create the checkboxes, something like:

foreach ($values as $key => $value) {
        echo "<input type=checkbox value=$key> $value\n";
}

,----
| Regarding  text area  how to  manipulate the  new line  and  line feed
| correctly. so that the line changes in display also as in input.
`----

What display?  you mean when you  'echo' whatever textarea  out in PHP
you dont see the multilines? use '<pre>' in that case.

cheers,

  -Suraj

-- 
,-----------------[http://www.symonds.net/~suraj/]---o
| M. S. Subbulakshmi is a student of Semmangudi Srinivasa Iyer
`------------------------------[suraj@xxxxxxxxxxx]---o

Other related posts: