5 Replies Latest reply: Oct 29, 2013 8:14 AM by MurraySummers RSS

    adding script on buttons

    JoshMathews

      Hi,

       

      I was making a newsletter using Dreamweaver CS6, I want to add a yes and no button. When someone clicks on the Yes button in the newsletter it just sends us a notification of their email address and that they are interested with us. Nothing happens on the newsletter though when they click on the button except the NO button then disappears.

       

      Can I someone help me with this please ?

       

      Thanks,

      Josh

        • 1. Re: adding script on buttons
          osgood_ CommunityMVP

          You obviously somehow need the recievers email address to be associated with the button/s if you want to retrieve the information.

           

          <a href="process.php?email=emailAddress?response=YES">YES</a>

           

          <a href="process.php?email=emailAddress?response=NO">NO</a>

           

          You can then send the information to process.php which is a php script to obviously get the information set in the link, which will then mail the information to your email address.

           

          The key is how do you propose to associate the recievers email address with the button. You could have all the email addresses in a database and loop throught it.

           

          <a href="process.php?email=$row['emailAddress']?response=YES">YES</a>

           

           

          if you're just sending the newsletter out individually then you could change the email each time but that is going to get a little tedious:

           

          <a href="process.php?email=someone@something.com?response=YES">YES</a>

          • 2. Re: adding script on buttons
            JoshMathews Community Member

            Thanks for the reply.

             

            Yes all the emails will be extracted from a database listed on our CRM, so its gonna be a bulk email newsletter.

            So if I insert the process.php code it would automatically pick up the users email when they click on it and send their info on our email?

             

            Sorry for asking this, havent done this kind of script before for a newsletter.

             

            Thanks.

            • 3. Re: adding script on buttons
              osgood_ CommunityMVP

              JoshMathews wrote:

               

              Thanks for the reply.

               

              Yes all the emails will be extracted from a database listed on our CRM, so its gonna be a bulk email newsletter.

              So if I insert the process.php code it would automatically pick up the users email when they click on it and send their info on our email?

               

              The process.php script file will be housed on your server. When the email recipient clicks on the YES or NO button in the newsletter email the recipients email address will be sent to the process.php page and then sent to your email address, the recipient will be taken to a confrimation page confirming that they said YES. You can include a 'location redirect' in the process.php script to do this.

               

              Essentailly this is just like collecting information via a form on a website only in this case the information is collected via variables which have been attributed to the YES/NO button in the email newsletter.

              • 4. Re: adding script on buttons
                JoshMathews Community Member

                Thanks a lot, its quite complicated than I thought since I dont know how to house the script on the server and asking programmers to do it will just make the process longer, will see if I can find any simpler solution.

                 

                Thanks a lot though.

                • 5. Re: adding script on buttons
                  MurraySummers CommunityMVP

                  Here's how it might also work:

                   

                  1. Of course, nothing will work if the recipient of the newsletter is NOT connected to the internet at the time that they are reading it.

                  2. If they are reading the newsletter and they click on the YES button, you could take them to a web page containing a simple form that simply requests their email, and when that form is submitted, it could send an email to the internal party keeping track of the mailing list - the script should be as simple as -

                   

                  <?php

                   

                  $to="whatevere@example.com";

                  $from="FROM: website@whatever.com";

                  $subject="Maillist request";

                  $message="This individual wants to stay on your maillist:" . $_POST['email'];

                  $success=mail($to, $subject, $message, $from);

                  $confirmation="Thanks for joining our maillist!";

                  ?>

                   

                  Then on the page body you would have this -

                   

                  <?php if($success) { echo "<h2>$confirmation</h2>"; } ?>

                  <form action="<?php $_SERVER['self']; ?>" method="POST" name="mailing">

                  <label for="email">Email: </label>

                  <input type="text" name="email" id="email" placeholder="Enter email address">

                  <input type="submit" value="YES" name="submit" id="submit">

                  <input type="button" value="NO" onclick="document.mailing.submit.disabled=true">

                  </form>

                   

                  That would take care of the YES button by disabling it once the NO button is clicked. Refreshing the page would clear the field and re-enable the YES button.