in reply to passing CGI form parameters via HTML email


Ahem. You failed to mention what happens when you try to use the form in an email client. Does it do nothing? Does it produce an error?

My guess is that the email client you're using is preventing the form from working as a security measure. Try testing it with a variety of clients.


  • Comment on Re: passing CGI form parameters via HTML email

Replies are listed 'Best First'.
Re^2: passing CGI form parameters via HTML email
by gmacfadden (Sexton) on Jun 22, 2006 at 00:38 UTC
    Sorry, I did not realize anything in all caps was unwelcome form. Please forgive me. I shall respond to your questions in order.

    When I invoke CGI script 1 via server side HTML, I get the desired and expected output: e.g.
    $subject is: {input from HTML form}
    $comments is: {other input from HTML form} other words, everything works fine.

    When I invoke CGI script 1 via responding to the HTML email which is created by CGI script 2, and thence sent to my AOL client side email account, I get: e.g.

    $subject is: {all blank}
    $comments is: {all blank}
    .......see, I'm expecting the same output results, as the inputs provided for subject and comments are the same (instead I get blanks)

    I got the idea to try this after my car was serviced and the service provider sent an email to my AOL email account that contains a satisfaction survey embedded in the body of the AOL email message. Since the service provider's survey worked, I'm inclined to believe the problem is with my code, not the security features on my email client. I hope this gives you a better feel for the problem. If anything still isn't clear, I'm happy to provide more information. Thank you for your patience.
      Well, I just tried this out. I sent the email from my work server, and picked it up at home, via Thunderbird.

      The URL pointed to your script, which I copied to a local machine here.

      I used the subject "Test" and the comment "Foo"

      when I clicked the submit button in the email I got:

      $subject is Test $content is

      The URL was correct:

      Further analysis shows that the form variable in your scripts is set to a different name than what you're trying to print. IE, you do this in your script that generates the email:

      Comments: <textarea name="content" rows="2" cols="15"></textarea>

      and this in your script that prints:

      my $comments = param("comments");

      So, I think you have a combination of things. 1) Your CGI parameter is wrong, and 2) AOL may not be letting you submit properly (or may be munging your HTML as was suggested above)

        After correcting the CGI parm, everything worked properly on a different email client (AOL email not being very friendly). Thanks for the great help.
      Try sending it to a few different email clients. AOL is probably the most aggressive HTML mangler around, so it's quite likely you'll find that your form works elsewhere. If that turns out to be the case, take a close look at the form as it appears in AOL via "View Source". Also, you might take a close look at the form that did work - perhaps it does things in a way you can copy.