Loading ...
Sorry, an error occurred while loading the content.

Passing two variables through one checkbox

Expand Messages
  • Greg Krieser
    Hello Everyone, Is it possible to pass two variables to a script through one check box? If a check box is selected I d like it to pass the script a
    Message 1 of 4 , Mar 5, 2002
    • 0 Attachment
      Hello Everyone,

      Is it possible to pass two variables to a script through one check box? If a check box is selected I'd like it to pass the script a description and a price. I could put both in the checkbox value, i.e. description|9.99. Once I've parsed the form data how would I break this value into two variables?

      Thanks for all of your help,

      Greg
    • b_harnish
      ... see the split function
      Message 2 of 4 , Mar 5, 2002
      • 0 Attachment
        --- In perl-beginner@y..., "Greg Krieser" <greg@k...> wrote:
        > Hello Everyone,
        >
        > Is it possible to pass two variables to a script through one check box? If a check box is selected I'd like it to pass the script a description and a price. I could put both in the checkbox value, i.e. description|9.99. Once I've parsed the form data how would I break this value into two variables?
        >
        > Thanks for all of your help,
        >
        > Greg

        see the split function
      • Mike Payne
        ($name, $price) = split(/|/,$checkboxvalue,2); -Mike Payne ... From: Greg Krieser [mailto:greg@krieser.com] Sent: Tuesday, March 05, 2002 10:31 AM To: Beginner
        Message 3 of 4 , Mar 9, 2002
        • 0 Attachment
          ($name, $price) = split(/|/,$checkboxvalue,2);


          -Mike Payne
          -----Original Message-----
          From: Greg Krieser [mailto:greg@...]
          Sent: Tuesday, March 05, 2002 10:31 AM
          To: Beginner Perl
          Subject: [PBML] Passing two variables through one checkbox


          Hello Everyone,

          Is it possible to pass two variables to a script through one check box?
          If a check box is selected I'd like it to pass the script a description and
          a price. I could put both in the checkbox value, i.e. description|9.99.
          Once I've parsed the form data how would I break this value into two
          variables?

          Thanks for all of your help,

          Greg

          Yahoo! Groups Sponsor
          ADVERTISEMENT




          Unsubscribing info is here:
          http://help.yahoo.com/help/us/groups/groups-32.html

          Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



          [Non-text portions of this message have been removed]
        • Jeff 'japhy' Pinyan
          ... You need to escape the |, since it s a regex metacharacter. -- Jeff japhy Pinyan japhy@pobox.com http://www.pobox.com/~japhy/ RPI Acacia
          Message 4 of 4 , Mar 10, 2002
          • 0 Attachment
            On Mar 9, Mike Payne said:

            > From: Greg Krieser [mailto:greg@...]
            >
            >>If a check box is selected I'd like it to pass the script a description
            >>and a price. I could put both in the checkbox value,
            >>i.e. description|9.99. Once I've parsed the form data how would I break
            >>this value into two variables?
            >
            >($name, $price) = split(/|/,$checkboxvalue,2);

            You need to escape the |, since it's a regex metacharacter.

            --
            Jeff "japhy" Pinyan japhy@... http://www.pobox.com/~japhy/
            RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
            ** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
            <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
            [ I'm looking for programming work. If you like my work, let me know. ]
          Your message has been successfully submitted and would be delivered to recipients shortly.