CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Perl/ CGI (http://www.codingforums.com/forumdisplay.php?f=5)
-   -   Creating and filling an array with 3 fields per record (http://www.codingforums.com/showthread.php?t=2885)

Jeepers 07-28-2002 09:45 PM

Creating and filling an array with 3 fields per record
 
Hi Guys

Excuse the database type language of my array description, I don't know waht else to call it/them.

2 part question

Assuming it is possible for a checkbox on a form to have 3 values to it (thats the 2nd question) how would I a) create the array to hold those values b) get the information from the form after submission into the array c) access the information for e.g. emailing. I know how to create an array to hold the split name / value pair and access that info but that is about all. I'm learning as I go from examples and alterations.

My 2nd question, which is not Perl related but, :D is relavant the first question. Using normal HTML on a form is it possible for a checkbox (or anything else for that matter) to have more than a 'name' and 'value'. Ideally I would like to have three values (to fill the above array). If it is possible, would it be 3 'names' with 3 'values' or 1 'name' with 3 'values' or what?

Just thought of this as well. I need to split up a string of characters say thedir/thefile.ext ($file).
I know that ($ext) = $file =~ m,\.([^\.]*)$,; will give ext
and ($flnm) = $file =~ m,\/([^\/]*)$,; will give thefile.ext
but how would I get thedir/?

Any info would be great, what would be better, please please please, would be example code so I can undersatnd it and find out how it works.

Thanks :thumbsup:

kharaktur 07-29-2002 04:44 AM

Sorry, I don't really understand your checkbox question but a simple way to split your example string would be:

$str = "thedir/thefile.ext";
@s = split(/\W/, $str);

Results in @s:
thedir
thefile
ext

Hope this helps.


All times are GMT +1. The time now is 02:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.