in reply to Re: form recipients
in thread form recipients

Thank you first off, Secondly, I think my problem may be were I am putting these lines. I don't have any success. The particular field I need is the  print MAIL "<font color=\"#FF0000\"><b>US Citizen? </b>$FORM{'ckusyes'} $FORM{'ckusno'}</font><br>"; If the 'chusno' field is selected then either add a recipient or change the recipients all together.

Replies are listed 'Best First'.
Re: Re: Re: form recipients
by arden (Curate) on Mar 10, 2004 at 18:51 UTC
    That is too late. You need to check  $FORM{'ckusno'} BEFORE you  open(MAIL ... and alter the value of $recipients then. You can still re-use the variable in the body of the email message, but you need to know who to send the message to before you start to send the message.

    - - arden.

      How do you check the value prior to putting this in the body?
      ARDEN, Thank you again for your help. I have tried a few things and everytime I make some changes it does not recognize the CGI when I submit the form. As mentioned above, how do I declare the values of the check boxes before the open(mail..? Thanks in advance.
        Before you open the pipe to sendmail but after parsing the CGI query into %FORM, you need to change the $recipients based on the checkbox value:
        if ($FORM{'chkno'}) { $recipients .= " foo@example.com"; } <code> Then, the command will look like: <code> |/usr/lib/sendmail yogibear@test.edu foo@example.com
        The To: line needs to have commas separating the addresses instead of spaces.
        To: yogibear@test.edu, foo@example.com
        Finally, you need to add a blank line between the end of the headers and the start of the HTML.
        print MAIL "Content-Transfer-Encoding: 7bit\n"; print "\n"; print MAIL "<html><head>\n";
      Sorry, The last questions was me, forgot to login.
      Arden, You will have to forgive me a little. I inherited this from our perl expert who has left our company. I am a .net programmer with little experience on the CGI front. I have managed to get the basics running but taking these a step further has proven to be a little bit of a challenge.