1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

subscribe form.,need badly help

Discussion in 'PHP & Perl' started by thorjack1990, May 2, 2013.

  1. thorjack1990

    thorjack1990 BANNED BANNED

    Joined:
    Feb 15, 2013
    Messages:
    71
    Likes Received:
    9
    anyone know how to make this subscribe form


    http://s1118.photobucket.com/user/roiancuares/media/subscribe_zps5454177e.jpg.html


    a pop up will appear if blank the form is blank.,plz
     
  2. jeanlance

    jeanlance Power Member

    Joined:
    Mar 5, 2009
    Messages:
    796
    Likes Received:
    109
    Occupation:
    Web Designer, VCC supplier
    Location:
    Some where between heaven and hell
    Home Page:
    Add me on skype i can help you with that

    Skype : floralchamp
     
  3. DeJohn

    DeJohn Newbie

    Joined:
    Nov 10, 2012
    Messages:
    41
    Likes Received:
    16
    Home Page:
    Hello,

    Here is an example:

    yourpage.html

    Code:
    <html>
    <head>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/jquery-ui.min.js"></script> 
    <script type="text/javascript">
        //<![CDATA[
    
        function checkform(theForm) {
        
            var d=0;
            if ($("#firstname").val() == "") {
            d=d+1;
            }
            if ($("#lastname").val() == "") {
            d=d+1;
            }
            if ($("#email").val() == "") {
            d=d+1;
            }
            if (d > 0) {
                alert("Please complete all fields!");
                return false;
            }
            theForm.submit();
            return false;
        }
        //]]>
    </script>
    </head>
    
    <body>
    <form id="test" action="page.php" onsubmit="checkform(this); return false;" method="POST" >
    <input type="text" name="firstname" id="firstname" placeholder="First name*"><br/>
    <input type="text" name="lastname" id="lastname" placeholder="Last name*"><br/>
    <input type="text" name="email" id="email" placeholder="Email*"><br/>
    <input type="submit" name="submit" id="submit" value="Subscribe">
    </form>
    </body>
    </html>
    You have to customize it in CSS , this is just the basic code.

    Also do you need the .php page which inserts subscriptions into database ?
     
    • Thanks Thanks x 1
  4. thorjack1990

    thorjack1990 BANNED BANNED

    Joined:
    Feb 15, 2013
    Messages:
    71
    Likes Received:
    9
    how do i specify the pop-up when one filled was blank.
    when clicking the subscribe button.,it will automatically email the First name, last name, and email.,how do i make it?
    sry im just a newbie with web developing
     
  5. nocare

    nocare Junior Member

    Joined:
    Apr 29, 2013
    Messages:
    164
    Likes Received:
    81
    Location:
    Deep Code
    Code:
    <form onsubmit="return checkForm(this);" action="myscript.php" method="post">
        <input type="text" name="name" />
        <input type="password" name="pass" />
        <input type="submit" value="Subscribe" />
    </form>
    
    Now, the script that handles this is up to you. Its very simple, and you won't get far in the world doing such things without learning to code... or paying someone to do it. There are services that will handle forms for you, but given the simple nature I highly recommend learning.Search for handling forms in php, assuming you are dealing with a php server and have access to writing scripts on it.
     
    Last edited by a moderator: May 3, 2013
  6. DeJohn

    DeJohn Newbie

    Joined:
    Nov 10, 2012
    Messages:
    41
    Likes Received:
    16
    Home Page:
    My example will return a popup if all fields are empty or at least one.

    If you want to store first name, last name and email into a database you have to create the connection and use mysql_query function for php to insert into database. Or you can use jquery $.post function to send action to a php script directly, so when press subscribe people won't be redirected to yourpage.php (page that inserts firstname,lastname,email into database).

    If you want to email the Firstname,Lastname and Email to a specified email you have to use in that php page the mail() or a php mail handler.
     
    • Thanks Thanks x 1
  7. techblog

    techblog Jr. VIP Jr. VIP

    Joined:
    Feb 12, 2013
    Messages:
    1,222
    Likes Received:
    383
    Occupation:
    Freelancer
    Location:
    Email Server
    well OP , check codecanyon or themeforest , you will get just what you want... happy hunting! :)
     
  8. Abh_Empire

    Abh_Empire Regular Member

    Joined:
    Sep 21, 2010
    Messages:
    220
    Likes Received:
    46
    Location:
    Romania
    There's no way you'll learn how to make that form functional by asking advices on a forum, it may look really simple to programmers like DeJohn, but you need to know HTML, PHP and Javascript at least at a basic level just to follow the instructions.
    At your current level, i presume close to zero, your best bet is to pay someone to make it functional. Or beg.
     
  9. Wister_fr

    Wister_fr Registered Member

    Joined:
    Sep 6, 2012
    Messages:
    62
    Likes Received:
    23
    Location:
    Internet
    Thx for this code, I will keep it for my projects :)

    Thorjack1990: By using JS to avoid errors on submit, you won't protect yourself against bots.