Email Subscription Form | Sanwebcorner

Email Subscription Form

This is one of the important concept The Email Subscription or Newsletter SignUp, This concept is used get the user Name and Email for to Provide our Latest Updates to the clients.

This is several ways to get Email Id from customer first one is to get email and name from user and store it to the text documents (like Notepad)

The second option is to get the Email id from customer and store it to the database table.

The Third one is to  store the Email id and customer name to the Our Email.

In this post i am explain about the First way , That is to store the email and name to the Notepad or Text Documents.

Remaining I will post after a few days....


Email-Subscription-Form


Index.html:

<!DOCTYPE HTML>
<html>
<head>
<title>Simple Email Subscription Form | san web corner</title>
<META NAME='Keywords' lang='en-us' CONTENT='newsletter Signup, mailing list, subscriber, JQuery, PHP, mySQL, sign-up form'>
  <META NAME='description' CONTENT='A newsletter opt-in form using JQuery, PHP, mySQL.'>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  <script>
var thankyou = "Thank you";
function signup(thisform) {
    $("#submit, #myResponse")
      .hide();
    $("#loading")
      .show();
    params = $("#subform")
      .serialize();
    $.post("sub.php", params,
      function(response) {

        $("#loading")
          .hide();
        $("#myResponse")
          .html(thankyou);
        $('#myResponse')
          .css({
            display: 'inline',
            color: 'green'
          })
        $("#submit")
          .show();
      })
    return false;
  }
  //-->
  </script>
  <style>
td {
  padding: 5px;
}
  </style>
</head>

<body>
  <form onsubmit="return signup(this);return false;" method="post" name="subform" id="subform" action="sub.php">
    <table width="400" border="1" style="border-collapse:collapse;" align="center" ;>
      <tr>
        <td>
          <label style="display: inline-block;width:135px">Email:</label>
        </td>
        <td>
          <input type="email" required id="email" name="email" value="">
        </td>
      </tr>
      <tr>
        <td>
          <label style="display: inline-block;width:135px">Name:</label>
        </td>
        <td>
          <input type="text" required name="name" id="name" value="">
        </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>
          <input type="submit" id="submit" name="submit" value="Sign up">
        </td>
      </tr>
      <tr>
        <div style="width:100%"><span id="Error" style="color:red;display:none;"></span>
        </div>
        <div id="myResponse" style="DISPLAY:none; text-align:center; width:100%; margin-left:auto; margin-right:auto;"></div>
      </tr>
      <tr>
      </tr>
    </table>
  </form>
</body>
</html>

Sub.php

<?php
$email = trim(htmlspecialchars($_REQUEST["email"]));
$name = trim(htmlspecialchars($_REQUEST["name"]));
$pfileName = "mails.txt";
$MyFile = fopen($pfileName, "a");
$nline="\"Email : ".$email."\"" ."----" ."\"Name : ".$name."\"" ."\r\n";
fwrite($MyFile, $nline);
fclose($MyFile);
die;
?>

In This I am using html and javascript and php to display error message and display the thanks message and validation.

You have to create one Notepad document name it as a mails 

Your Result Like below :

Email-Subscription-result



Post a Comment

Labels

360 degree view product image 3d rotate 3d text 3step-form Accordion menu ajax All Browsers Animated Background Gradient animation audio controller auto complete Best accordion menu bootstrap border bounce effect on hover Breadcrumb calculate age by dob calendar Captcha change image on mouse move color chooser countdown Counter on scroll create random number Css css animation css buttons css hover css3 customized upload Button Date picker delete data from table Different scroll speed email otp verification email verifier Embed eventlist Expanding Menu feedbck form flash news section close button full screen menu Google custom search Google Maps Google reCAPTCHA Google site search gradient hide menu Horizontal News ticker Hover Htm Html html dropdown html form html5 html5 form validation Iframe image hover increment decrement textbox value based on select box Javascript Jquery js Layered image effect on mouse hover lock & unlock page scroll marquee marquee with close button mobile number validation mobile otp login Multi-level-drop-down-menu multi-level-form Multi-Step-form mysql News ticker on hover change text to image our team page password generator password strength checker Photoshop PHP populate html selectbox Popup image on click the link pure css Question type form random number generate Random password Redirect page Based on the select box while submit the form responsive responsive menu responsive popup box Responsive Vertical Time line design rotate image selectbox based on select box simple coming soon page simple countdown based on end date simple typing effect slider sliding tab sms otp login statistic counter on scroll switch tag shape team member Time picker toggle toggle view transparent button underline animation up down slide validation vertical fixed sidebar Webtips Youtube