Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-28-2002, 09:45 PM   PM User | #1
Jeepers
Regular Coder

 
Join Date: Jun 2002
Location: Conwy. UK
Posts: 122
Thanks: 0
Thanked 0 Times in 0 Posts
Jeepers is an unknown quantity at this point
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, 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
__________________
An answer needs a question just as much as a question needs an answer. Deep eh!
Jeepers is offline   Reply With Quote
Old 07-29-2002, 04:44 AM   PM User | #2
kharaktur
New to the CF scene

 
Join Date: Jul 2002
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
kharaktur is an unknown quantity at this point
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.
kharaktur is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:41 AM.


Advertisement
Log in to turn off these ads.