13 Replies Latest reply on Sep 8, 2008 7:35 PM by Newsgroup_User

    Need help with a snippet of code

    b3enthusiast
      Dear Board Members.

      I need help with a line of code. I have a page set up www.riveroflightchurch.com/allenhtml

      I need the check boxes to notify me by email about which people have been contacted. So, the user would check off the people he/she has contacted and then the results would be submitted to me via email.

      I am receiving the emails from the site, but they are blank----in other words even if someone checks a box, the email doesnt list it as being checked.

      I need someone to help me with the line of code that should be in my .php file which would tell the php file to send the check box information in the email.

      Can anyone help me?

      Thanks,
      B3
        • 1. Re: Need help with a snippet of code
          Level 7


          > www.riveroflightchurch.com/allenhtml

          nope.
          here:
          http://www.riveroflightchurch.com/allen.html

          action=" http://www.freedback.com/mail.php"

          third party form processing? there isn't a script on the site's hosting?

          <input type="checkbox" name="Janice Freeman" id="field-b075039186c7152_0"

          Name and ID must match, they must be unique and not used again for some
          other item. And there shouldn't be blank spaces in them.

          so first guess- try renaming each of the checkbox fields so they are like
          this for example:

          <input type="checkbox" name="Janice_Freeman" id="Janice_Freeman"
          --
          Alan
          Adobe Community Expert, dreamweaver

          http://www.adobe.com/communities/experts/



          • 2. Re: Need help with a snippet of code
            DwFAQ Level 4
            Take a look at this page it should help you out.

            http://JasperThayer.com/forms
            • 3. Need help with a snippet of code
              b3enthusiast Level 1
              Dear Board Members,

              Thanks for your reply...Below is my current code:

              Here is the code I currently have in place, i am a total novice at forms, could you maybe help me with what is going wrong here?----It is not making a lot of sense, and you will probably laugh at my abilities, but I designed graphically and not with code......of course when dealing with server scripting and all that, code is the very thing I need. Here's what I have:

              html code:
              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <html xmlns=" http://www.w3.org/1999/xhtml">
              <head>
              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
              <title>Untitled Document</title>
              <style type="text/css">
              <!--
              .style1 {
              font-family: Geneva, Arial, Helvetica, sans-serif;
              font-size: 14px;
              }
              .style4 { font-family: Arial, Helvetica, sans-serif;
              font-size: 12px;
              }
              .style3 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; }
              -->
              </style>
              </head>

              <body><form method="post" action="allen.php">
              <p>
              <label><!-- Begin Freedback Form -->
              <!-- DO NOT EDIT YOUR FORM HERE, PLEASE LOG IN AND EDIT AT FREEDBACK.COM -->
              <form enctype="multipart/form-data" method="post" action=" http://www.freedback.com/mail.php" accept-charset="UTF-8">
              <div>
              <p align="left"><strong><span class="style4">
              <input name="Lambert &amp; Valrie Duncan" type="checkbox" id="Lambert &amp; Valrie Duncan" value="" />
              Lambert &amp; Valrie Duncan
              </span></strong></p>
              <p align="left" class="style3">
              <input name="Janice Freeman" type="checkbox" id="Janice Freeman" value="" />
              Janice Freeman</p>
              <p align="left" class="style3">
              <input type="checkbox" name="Hector &amp; Lurlene Gilzene" id="Hector &amp; Lurlene Gilzene" />
              Hector &amp; Lurlene Gilzene</p>
              <p align="left" class="style3">
              <input type="checkbox" name="Loraine Johnson" id="Loraine Johnson" />
              Loraine Johnson</p>
              <p align="left" class="style3">
              <input type="checkbox" name="Clayton Little" id="Dan Wright" />
              Dan Wright</p>
              <p align="left" class="style3"> </p>
              </div>
              </form>
              <br><center>
              </center>

              <br />
              <input type="submit" />
              </p>
              </form>
              </body>
              </html>


              .php code

              <?php

              // ------------- CONFIGURABLE SECTION ------------------------

              // $mailto - set to the email address you want the form
              // sent to, eg
              //$mailto = "youremailaddress@example.com" ;

              $mailto = 'rickelmoresmail@mac.com' ;

              // $subject - set to the Subject line of the email, eg
              //$subject = "Feedback Form" ;

              $subject = "Alfred &amp; Cynthia Allen Contact Results" ;

              // the pages to be displayed, eg
              //$formurl = " http://www.example.com/feedback.html" ;
              //$errorurl = " http://www.example.com/error.html" ;
              //$thankyouurl = " http://www.example.com/thankyou.html" ;

              $formurl = " http://www.riveroflightchurch.com/allen.html" ;
              $errorurl = " http://www.riveroflightchurch.com/error.html" ;
              $thankyouurl = " http://www.riveroflightchurch.com/successful.html" ;

              $email_is_required = 0;
              $name_is_required = 0;
              $uself = 1;
              $use_envsender = 1;
              $use_utf8 = 1;

              // -------------------- END OF CONFIGURABLE SECTION ---------------

              $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
              $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ;
              if (!isset( $use_envsender )) { $use_envsender = 0 ; }
              $envsender = "-f$mailto" ;
              $name = $_POST['name'] ;
              $email = $_POST['email'] ;
              $comments = $_POST['comments'] ;
              $http_referrer = getenv( "HTTP_REFERER" );

              if (!isset($_POST['email'])) {
              header( "Location: $formurl" );
              exit ;
              }
              if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name))) {
              header( "Location: $errorurl" );
              exit ;
              }
              if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
              header( "Location: $errorurl" );
              exit ;
              }
              if (empty($email)) {
              $email = $mailto ;
              }

              if (get_magic_quotes_gpc()) {
              $comments = stripslashes( $comments );
              }

              $messageproper =
              "This message was sent from:\n" .
              "$http_referrer\n" .
              "------------------------------------------------------------\n" .
              "Name of sender: $name\n" .
              "Email of sender: $email\n" .
              "------------------------- COMMENTS -------------------------\n\n" .
              $comments .
              "\n\n------------------------------------------------------------\n" ;

              $headers =
              "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.12.0" .
              $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;

              if ($use_envsender) {
              mail($mailto, $subject, $messageproper, $headers, $envsender );
              }
              else {
              mail($mailto, $subject, $messageproper, $headers );
              }
              header( "Location: $thankyouurl" );
              exit ;

              ?>

              • 4. Re: Need help with a snippet of code
                Level 7
                I wouldn't think so, unless you are describing how to make your domain an
                open relay for spam emails. These recommendations are a serious hazard.

                --
                Murray --- ICQ 71997575
                Adobe Community Expert
                (If you *MUST* email me, don't LAUGH when you do so!)
                ==================
                http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                ==================


                "Jasper Thayer" <webforumsuser@macromedia.com> wrote in message
                news:ga0o0k$1pf$1@forums.macromedia.com...
                > Take a look at this page it should help you out.
                >
                > http://JasperThayer.com/forms

                • 5. Re: Need help with a snippet of code
                  Level 7

                  "b3enthusiast" <webforumsuser@macromedia.com> wrote in message
                  news:ga0lot$sl3$1@forums.macromedia.com...

                  > Dear Board Members.

                  Huh? Just to be sure you know, your post will be read only by volunteers.

                  --
                  Patty Ayers | www.WebDevBiz.com
                  Free Articles on the Business of Web Development
                  Web Design Contract, Estimate Request Form, Estimate Worksheet
                  --

                  • 6. Re: Need help with a snippet of code
                    DwFAQ Level 4
                    Murray,

                    Never had a problem with spam using this method. Perhaps instead of bashing a suggestion you could provide an alternative solution that would be recommended...
                    • 7. Re: Need help with a snippet of code
                      Level 7

                      "Jasper Thayer" <webforumsuser@macromedia.com> wrote in message
                      news:ga4005$lie$1@forums.macromedia.com...
                      > Murray,
                      >
                      > Never had a problem with spam using this method. Perhaps instead of
                      > bashing a suggestion you could provide an alternative solution that would
                      > be recommended...

                      What exactly is "bashing", to you, Jasper? Murray's polite, professional,
                      and accurate post?


                      --
                      Patty Ayers | www.WebDevBiz.com
                      Free Articles on the Business of Web Development
                      Web Design Contract, Estimate Request Form, Estimate Worksheet
                      --

                      • 8. Re: Need help with a snippet of code
                        DwFAQ Level 4
                        I'm sorry P@tty did you have a contribution to the discussion that would benefit the topic or are you just here to defend?
                        • 9. Re: Need help with a snippet of code
                          Level 7
                          You would not know whether you had a problem with that code, since it's not
                          YOUR inbox I'm talking about. It's MINE. The snippet you posted does NO
                          checking for Email injection, which is most likely responsible for something
                          in excess of 50% of all spam emails. Read this to educate yourself about
                          the magnitude of the problem and ways to guard against it. It's not just
                          unprofessional not to check for this kind of thing, it should be illegal.

                          http://www.nyphp.org/phundamentals/email_header_injection.php

                          --
                          Murray --- ICQ 71997575
                          Adobe Community Expert
                          (If you *MUST* email me, don't LAUGH when you do so!)
                          ==================
                          http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                          http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                          ==================


                          "Jasper Thayer" <webforumsuser@macromedia.com> wrote in message
                          news:ga4005$lie$1@forums.macromedia.com...
                          > Murray,
                          >
                          > Never had a problem with spam using this method. Perhaps instead of
                          > bashing a suggestion you could provide an alternative solution that would
                          > be recommended...

                          • 10. Re: Need help with a snippet of code
                            Level 7
                            I totally agree, Jasper.

                            In addition (I only did a quick scan of your PHP), it /seems/ your
                            script depends on register_globals being on - a Bad Thing(TM).

                            It is off by default in PHP5 installations and will be removed in PHP6.
                            http://us.php.net/register_globals

                            Best to get the field data with $_POST['field_name'] in this case.

                            And, just to emphasize, NEVER trust data from the visitor. Always
                            validate such data before acting on it in any way.


                            Murray *ACE* posted in macromedia.dreamweaver:

                            > You would not know whether you had a problem with that code, since
                            > it's not YOUR inbox I'm talking about. It's MINE. The snippet you
                            > posted does NO checking for Email injection, which is most likely
                            > responsible for something in excess of 50% of all spam emails.
                            > Read this to educate yourself about the magnitude of the problem
                            > and ways to guard against it. It's not just unprofessional not to
                            > check for this kind of thing, it should be illegal.
                            >
                            > http://www.nyphp.org/phundamentals/email_header_injection.php
                            >
                            > --
                            > Murray --- ICQ 71997575
                            > Adobe Community Expert
                            > (If you *MUST* email me, don't LAUGH when you do so!)
                            > ==================
                            > http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                            > http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                            > ==================
                            >
                            >
                            > "Jasper Thayer" <webforumsuser@macromedia.com> wrote in message
                            > news:ga4005$lie$1@forums.macromedia.com...
                            >> Murray,
                            >>
                            >> Never had a problem with spam using this method. Perhaps instead
                            >> of bashing a suggestion you could provide an alternative solution
                            >> that would be recommended...



                            --
                            Mark A. Boyd
                            Keep-On-Learnin' :)
                            • 11. Re: Need help with a snippet of code
                              Level 7

                              "Jasper Thayer" <webforumsuser@macromedia.com> wrote in message
                              news:ga42ga$obo$1@forums.macromedia.com...
                              > I'm sorry P@tty did you have a contribution to the discussion that would
                              > benefit the topic or are you just here to defend?

                              Yes, Jasper, I had a contribution to the discussion: pointing out that the
                              fact that Murray politely disagreed with you isn't a good reason to accuse
                              him of "bashing". This isn't the only thread where you've made that type of
                              comment, and it's irritating and gets in the way of what we're trying to do
                              here.

                              --
                              Patty Ayers | www.WebDevBiz.com
                              Free Articles on the Business of Web Development
                              Web Design Contract, Estimate Request Form, Estimate Worksheet
                              --

                              • 12. Re: Need help with a snippet of code
                                DwFAQ Level 4
                                P@tty,

                                I think I can see clearly what you are trying to do here. This seems to me like a classic case of the pot attempting to call the kettle black. Please step off the coat tail of the high horse.

                                Best regards,
                                Jasper
                                • 13. Re: Need help with a snippet of code
                                  Level 7

                                  "Jasper Thayer" <webforumsuser@macromedia.com> wrote in message
                                  news:ga4enk$8qa$1@forums.macromedia.com...
                                  > P@tty,
                                  >
                                  > I think I can see clearly what you are trying to do here. This seems to
                                  > me
                                  > like a classic case of the pot attempting to call the kettle black.
                                  > Please
                                  > step off the coat tail of the high horse.

                                  I don't think you're right, but nice use of proverbs there anyway. :-)

                                  --
                                  Patty Ayers | www.WebDevBiz.com
                                  Free Articles on the Business of Web Development
                                  Web Design Contract, Estimate Request Form, Estimate Worksheet
                                  --