Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Passing Form Values To Another Page

    I would like to offer a "mini-form" on my homepage that would allow people to signup for my newsletter. The form would ask for their email. When they press submit, I want them to be taken to an expanded version of the form where they fill out there name and a few other details.

    My question is, if they fill out their email address on my homepage, how can I get the email address value to be auto-populate on the next page?

    If I'm being unclear, let me know.

    I really appreciate you help!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is an example of hou you can send it through a URL. The first page with the form asking for the Email Address:
    <html>
    <head>
    <title>Thank You Page Test</title>
    <SCRIPT LANGUAGE="JavaScript">
    function NewPage(frmobj)
    {
    if(frmobj.email_addr.value.length==0)
    {
    alert("Please Enter email address.")
    frmobj.email_addr.focus()
    }
    else
    {
    var passemail=frmobj.email_addr.value
    linkid="thankspage.html?"+passemail
    location.href=linkid
    }
    }
    </SCRIPT>
    </head>
    <body bgcolor="lightgreen" onLoad="document.myform.email_addr.focus();document.myform.reset()">
    <FORM NAME="myform" onSubmit="return NewPage()">
    <CENTER>
    Email Address:<INPUT TYPE="text" SIZE="30" MAXLENGTH="30" NAME="email_addr">
    <INPUT TYPE="button" VALUE="Send It" onClick="NewPage(this.form)"> <INPUT TYPE="reset" VALUE="Clear Form" > </CENTER>
    </FORM>
    </body>
    </html>

    The second page which displays the email address in a text box:
    <html>
    <head>
    <title>Thanks!</title>
    </head>
    <body bgcolor="lightblue">
    <FORM NAME="myform">
    <INPUT TYPE="text" NAME="email" SIZE="30">
    </FORM>
    <SCRIPT LANGUAGE="JavaScript">
    var passdata=unescape(location.search.substring(1,location.search.length))
    document.myform.email.value=passdata
    </SCRIPT>
    </body>
    </html>

    Also here is a link to a tutorial that give an explanation of how it works:
    http://www.javascriptkit.com/javatutors/send1.shtml

    Hope that helps and good luck.

  • #3
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks!

    Thank you so much!

    This board is such a great group of people. I have been an observer for sometime. Everyone always gets the help they need.

  • #4
    New Coder
    Join Date
    Jan 2003
    Location
    Belgium
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmz,

    It seems that u understand the code very well Requestcode

    Now I have a question.

    This script works grate, but can it be modified so the text that u send to another page will not apear in a textbox but in plain text so I can put it on my webpage. This way the script will serve as a "Next" button, on when clicked brings u to a page where u can verify your data and then let it be send to me.
    SToFFeL

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You want to display the data and if it is correct they can have it emailed to you or if it is not correct then send them back to the preveious page? Are you using a server side script to mail the data or the "mailto:" in the action field.

  • #6
    New Coder
    Join Date
    Jan 2003
    Location
    Belgium
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes, I found a script to let it be sent to me
    SToFFeL


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •