Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Conwy. UK
    Posts
    122
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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!

  • #2
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •