Email Signup Form Question

Discussion in 'PHP' started by caligrafx, Dec 7, 2010.

  1. #1
    I Have an email signup form in my website but I am looking to add a signup to my front page with just one line "email address" and then on submit the email address would carry over to the form for them to fill out the rest of the form!

    Could someone please let me how to go about get this one line on my front page to carry over to the form on the sign up page?

    Thanks for your time!
    Adam
     
    caligrafx, Dec 7, 2010 IP
  2. mweldan

    mweldan Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi.

    Supposed that you know how html form works, just
    1. change form method on front page to email sign up form page.
    2. retrieve input data from $_GET/$_POST.

    Dan
     
    mweldan, Dec 7, 2010 IP
  3. mweldan

    mweldan Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sorry, I mean form "action"

    Thank you.
     
    mweldan, Dec 7, 2010 IP
  4. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
    #4
    On first page, index.php

    
    <form id="emailform" method="post" action="getemail.php">
    <input type="text" id="email" />
    </form>
    
    Code (markup):
    Then on getemail.php

    
    form blah blah
    <input type="text" id="custemail" value="<?php echo $_POST["email"]; ?>" />
    form blah blah
    
    Code (markup):
    Should work in theory, probably minor syntax error, but that is the basic idea.
     
    jeremyhowell, Dec 7, 2010 IP
  5. caligrafx

    caligrafx Active Member

    Messages:
    137
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    83
    #5
    I added (value="<?php echo $_POST["fields_email"]; ?>") to the input of the email field in the php file and it shows up in the value of the html document.

    Would it matter if the files are html but calling up the php forms.

    This is what my index page has for the code;

    <div style="outline: 1px solid #111; border-top: 1px solid #555; background: #333; color:#fff; padding:5px;width:171px;display:block; text-align:center;">
    <form id="emailform" method="post" action="http://site.racefandiecast.com/contact-signup.html">
    <input type="text" value="Email Address" class="input" id="fields_email" onclick="if(this.value=='Email Address') { this.value=''; }" onblur="if(this.value=='') { this.value='Email Address'; }" style="background-image:url(http://site.racefandiecast.com/header/header2/images/search-text.png); background-position:center; text-shadow: 1px 1px 1px #FFF; width: 155px; height:16px; padding:7px; border:0px;" />
    <input style="margin:5px 0px 0px 5px;width:83px;" type="submit" value="Subscribe" />
    </form>
    
    Code (markup):
    Thanks for the help!
    Adam
     
    caligrafx, Dec 8, 2010 IP
  6. openbytes

    openbytes Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    pass it as a parameter

    subscribe.php?mail=example@example.org

    and then get the mail with GET.
     
    openbytes, Dec 8, 2010 IP
  7. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #7
    use it as link.html?email=email@address.com
    Try this code :

    
    <form id="emailform" method="post" action="http://site.racefandiecast.com/contact-signup.html">
    <input type="text" value="<?php echo (isset($_GET['email']) ? $_GET['email'] : 'Email Address';?>" class="input" id="fields_email" onclick="if(this.value=='<?php echo (isset($_GET['email']) ? $_GET['email'] : 'Email Address';?>') { this.value=''; }" onblur="if(this.value=='') { this.value='<?php echo (isset($_GET['email']) ? $_GET['email'] : 'Email Address';?>' }" style="background-image:url(http://site.racefandiecast.com/header/header2/images/search-text.png); background-position:center; text-shadow: 1px 1px 1px #FFF; width: 155px; height:16px; padding:7px; border:0px;" />
    <input style="margin:5px 0px 0px 5px;width:83px;" type="submit" value="Subscribe" />
    </form>
    
    PHP:
     
    tvoodoo, Dec 8, 2010 IP