Skip navigation
Currently Being Moderated

adding script on buttons

Oct 29, 2013 5:11 AM



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 ?




  • Currently Being Moderated
    Oct 29, 2013 5:28 AM   in reply to JoshMathews

    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?">YES</a>

    Mark as:
  • Currently Being Moderated
    Oct 29, 2013 6:06 AM   in reply to JoshMathews

    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.

    Mark as:
  • Currently Being Moderated
    Oct 29, 2013 8:14 AM   in reply to JoshMathews

    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 -






    $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">



    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.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points