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

Need help with a php form!

Discussion in 'PHP & Perl' started by Kelsen, Mar 8, 2011.

  1. Kelsen

    Kelsen Regular Member

    Joined:
    Feb 15, 2011
    Messages:
    287
    Likes Received:
    66
    I could use some help with an Email subscribe tool.


    This is what the Guide says


    Code:
          Install Optin ? Still on the Appearance > Editor page, click the ?optin.php?
    link. Replace the form elements in that file with those from your web  form and add any additional inputs that your web form may have.  
    and this is the optin.php code
    Code:
         <div class="fatlossoptin">
      <div class="fatlossoptincontent">
      <!-- Customize the form below so it works with your email service  provider. Make sure you keep the classes for the inputs and submit  button -->
        <form method='POST' name='NAMEHERE' action='Weight-loss-Ebook'>
    
          <table width="240" border="0" cellspacing="0" cellpadding="5" align="center">
            <tr>
              <td width="71">Name:</td>
              <td width="169">
                  <input type="text" name="textfield" id="NAMEIDHERE" class="text" />
                </td>
            </tr>
            <tr>
              <td>Email:</td>
              <td><input type="text" name="textfield2" id="EMAILIDHERE" class="text" /></td>
            </tr>
            <tr>
              <td colspan="2" align="center"><input type="submit" class="button" value=""/></td>
            </tr>
          </table>
        </form>
      </div>
    </div>
     
  2. Autumn

    Autumn Elite Member

    Joined:
    Nov 18, 2010
    Messages:
    2,197
    Likes Received:
    3,042
    Occupation:
    I figure out ways to make money online and then au
    Location:
    Spamville
    So what's your question?
     
    • Thanks Thanks x 1
  3. craigygee

    craigygee Regular Member

    Joined:
    Nov 5, 2009
    Messages:
    356
    Likes Received:
    209
    Occupation:
    Chef
    Location:
    313
    Home Page:
    What it means by replace the form elements is change the form id's/names to the ones you are using on your page for the form, it's quite simple. PM me if you still don't figure it out.
     
    • Thanks Thanks x 1
  4. Kelsen

    Kelsen Regular Member

    Joined:
    Feb 15, 2011
    Messages:
    287
    Likes Received:
    66
    I Lolled!
    The question is: What should I do?! I'm a noob in this kind of stuff.
    Thanks! I will try to figure it out tomorrow, i can't I shall pm you!
     
  5. BugFixed

    BugFixed Junior Member

    Joined:
    Sep 24, 2010
    Messages:
    130
    Likes Received:
    40
    Just guessing your intention.

    What you need to replace:
    -. name='NAMEHERE' action='Weight-loss-Ebook'
    replace this with: name="myoptinform" action="opintaction.php"

    -. name="textfield" id="NAMEIDHERE" class="text"
    replace this with: name="fullname" id="fullname"

    -. name="textfield2" id="EMAILHERE" class="text"
    replace this with: name="emailaddress" id="emailaddress"

    Now, you need 1 more file to create: opintaction.php
    This file will handle a post of your form once it gets submitted, for example:

    PHP:
    <?php
    $fullname 
    = isset($_POST["fullname"]) ? $_POST["fullname"] : "";
    $email = isset($_POST["emailaddress"]) ? $_POST["emailaddress"] : "";

    // make sure you have table ready on your database
    // f.i. table name is myoptin and it has fullname and emailaddress columns
    mysql_query("INSERT INTO myoptin (fullname,emailaddress) VALUES ('".mysql_real_escape($fullname).'", '".mysql_real_escape($email)."')"
    ?>
     
  6. Kelsen

    Kelsen Regular Member

    Joined:
    Feb 15, 2011
    Messages:
    287
    Likes Received:
    66
    grrrrrrrrr