[Ilugc] PHP Form Entries: Multi Select and Textarea

  • From: Malhotra.Ankit@xxxxxxxxx (Ankit Malhotra)
  • Date: Tue Sep 28 19:27:16 2004

Hi all,

I have some doubt regarding textarea and select box with multiple
entries in PHP as form entries.

The HTML form is as follows :

<form action="Target.php" method="get">
<textarea name="testta" rows=5 cols=40></textarea>
<br>
<select name="testms" multiple>
<option>a</option>
<option>b</option>
<option>c</option>
<option>d</option>
<option>e</option>
<option>f</option>
<option>g</option>
</select>
<br>
<input type="submit">
</form>

The target PHP

<?php
print("<p>".$_GET["testta"]."</p>");
print("<p>".$_GET["testms"]."</p>");
?>

submitted as : 
http://localhost/Temp/Target.php?testta=gfhhh%0D%0Acvvdfvsdfv%0D%0Aavadfv%0D%0A&testms=e

The result displayed :

gfhhh cvvdfvsdfv avadfv

e

--------------------------------------------------------------

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
to use check boxes i guess.  but again how do i parse out of the
variable number of sent in check boxes. The whole problem is that the
options available itself will be dynamic and out of that i have to
choose further.

Regarding text area how to manipulate the new line and line feed
correctly. so that the line changes in display also as in input.
--
3 Cheers for OSS.

Ankit Malhotra
(The BATFAN)
Registered Linux User # 349208 (http://counter.li.org)

Room # 224, C Block, Mens Hostel,
Vellore Institute of Technology,
Vellore, Tamil Nadu - 632014
Mobile : 9894184718

Other related posts: