Forum Moderators: coopster & phranque

Message Too Old, No Replies

how to split multiple values from text area submitted in cgi page

         

srinshcl

7:19 pm on Nov 12, 2005 (gmt 0)

10+ Year Member



How to add delimiter other than spaces to text area.If I enter multiple value to the text area and submit the data using the form ,the text area muliple values are separated by space delimiter ,where this will fail for me if i have the values like

config data
config values
config data values

where if i use space as delimiter it fails as i getting config and data as separate values.So i need to use any delimiter such as $,in text area,and if user gives muliple entries i will separate using delimiters like $,how to add delimiter to text area.
or can i split in cgi page after submitting the form.
where i am getting
$mode=$query->param('mode');

'mode' => 'config values config data values config data'.
when i submit an form where i hit an cgi page
how to separate the value i get from textarea in form.

Thanks,
srins.

bennymack

9:24 pm on Nov 12, 2005 (gmt 0)

10+ Year Member



It seems to me like the example data you showed should be splittable on the newline character "\n".

$mode=$query->param('mode');
@modes=split(/\n/,$mode);
print "$_<br />\n" for @modes;

lexipixel

5:23 am on Nov 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You didn't say who would be entering the data in the TEXTAREA, but if it's controllable, you could use anything for a delimiter...

Put a simple instruction ahead of the text area like;

"Enter each data item on a separate line"

- or -

"Enter data items separated by commas"

then parse input accordingly.

rocknbil

6:24 pm on Nov 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Anything entered by a user, even a savvy one, is prone to error. You can't rely on the user to correctly enter values. Period.

Can you generate this list as a series of checkboxes? That would solve both problems for you.