Ejemplo n.º 1
0
            <div class="text-center">
            <h2 id="unsubheader">We are sorry to hear that you are leaving.</h2>            
            <label id="unsubMailLabel">Please enter the email you subscribed with:</label>            
            </div>
            <br>
            <div class="form-group">
            <input class="form-control input-lg" type="email" placeholder="E-mail Address" name="email">
            <br>                       
            <input type="submit" class="btn btn-lg" name="unsub" value="Unsubscribe" />
            </div>
        </form>
        <?php 
if (isset($_GET['unsub'])) {
    if ($_GET['email'] != "") {
        $email = $_GET['email'];
        $unsub = Decider($email);
        if (filter_var($email, FILTER_VALIDATE_EMAIL) && $unsub == "removed") {
            ?>
        <script>
            var unsubMailLabel = document.getElementById("unsubMailLabel");
            unsubMailLabel.textContent = "You have been unsubscribed from the newsletter";
        </script>
        <?php 
        } else {
            ?>
        <script>
            unsubMailLabel.textContent = "No such email was found, please check your spelling and try again";
        </script>
        <?php 
        }
    }
Ejemplo n.º 2
0
                <label id="fieldPopulation">Please populate both fields</label>
                <br />
                <input type="text" placeholder="Name" name="name" />
                <input type="email" placeholder="Your E-mail Address" name="email" />
                <input type="submit" value="Subscribe!" name="subscribe" />

            </form>
        </div>

        <!-- script for the subscription fields and the passing of the fields to the database -->
        <?php 
if (isset($_GET['subscribe'])) {
    if ($_GET['name'] != "" and $_GET['email'] != "") {
        $name = $_GET['name'];
        $email = $_GET['email'];
        if (filter_var($email, FILTER_VALIDATE_EMAIL) && Decider($name, $email) != 'f') {
            ?>
        <script>
            document.getElementById("validEmail").style.display = "none";
            document.getElementById("fieldPopulation").style.display = "none";

            var newsletterLabel = document.getElementById("newsletterLabel");
            newsletterLabel.textContent = "Thank you for subscribing!"; 
        </script>
        <?php 
        } else {
            ?>
        <script>
            document.getElementById("fieldPopulation").style.display = "none";
        </script>
        <?php