52 users online (1 members and 51 guests)  


  Results 1 to 6 of 6

Related

  1. Replies: 1
  2. Passing results of script in one form to another.    Forum: Javascript Forum
    Replies: 0
  3. Replies: 1
  4. Form Results Processing    Forum: Website Scripts Forum
    Replies: 2
  5. overwrite results on submit form    Forum: HTML Forum
    Replies: 5
  1. #1
    murphy903's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2007
    Posts
    3

    How to use Form Results within same page

    I want to have a form at the top of my webpage that prompts the visitor to enter in their first name, last name and choose gender from a drop down box. I know how to create the form. What I don't know how to do is, 'how do I use the visitor's input info (results) in the text below the form?' I know it must be an easy task but I am a pre-novice. Thanks in advance for your help.

  2. #2
    mschutte's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2007
    Posts
    7

    Re: How to use Form Results within same page

    Let me see if I follow you correctly.
    You want to create a message at the bottom of the html page with the value of the first name text box, last name and the gender of the drop down.
    ok do this...
    HTML Code:
    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="javascript">
     function CreateMsg() {
      var MsgDOM = document.getElementById("MSG");
    MsgDOM.innerHTML = "Hello, " + document.forms[0].FNAME.value  + " " + document.forms[0].LNAME.value  + ". You're sex is " + document.forms[0].GENDER.value;
     }
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM NAME="DUH">
    <INPUT TYPE=TEXT NAME=FNAME>
    <INPUT TYPE=TEXT NAME=LNAME>
    <SELECT NAME="GENDER">
    <OPTION VALUE="Male">Male</OPTION>
    <OPTION VALUE="Female">Female</OPTION>
    </SELECT>
    <BR><BR>
    <A HREF="javascript:CreateMsg();">Create Message</A>
    <BR><BR>
    <SPAN ID="MSG">&nbsp;</SPAN>
    </FORM>
    </BODY>
    </HTML>
    This is just off the top of my head, hasn't been tested.

    CHANGE: I have tested this, and it works.
    Last edited by mschutte; 08-17-2007 at 08:40 PM.

  3. #3
    murphy903's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2007
    Posts
    3

    Re: How to use Form Results within same page

    That is exactly what I want. One more question though. How do I eliminate the gender part. I've decided that I don't need that part.

    What I ultimately want to accomplish is, after they've entered their first and last names, further down in the text, I want the following
    to appear as personal affirmations.

    Michael Murphy possesses personal power now.
    Michael, you can be, do and have anything your heart desires.
    Michael Murphy is designed for awesome accomplishment, engineered
    for amazing success and empowered with the seeds of greatness.
    Michael, you possess the power to choose your destiny now.


    Thank you so much.

    Michael Murphy
    Last edited by murphy903; 08-20-2007 at 08:54 AM.

  4. #4
    mschutte's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2007
    Posts
    7

    Re: How to use Form Results within same page

    Murphy,
    that should be a simple change. Take a look at the CreateMsg() function and modify it just how you want it.

  5. #5
    cautaro's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2007
    Posts
    2

    Re: How to use Form Results within same page

    To help you out I have changed the code so that the gender part is no longer there:
    Code:
    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="javascript">
     function CreateMsg() {
      var MsgDOM = document.getElementById("MSG");
    MsgDOM.innerHTML = "Hello, " + document.forms[0].FNAME.value  + " " + document.forms[0].LNAME.value;
     }
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM NAME="DUH">
    <INPUT TYPE=TEXT NAME=FNAME>
    <INPUT TYPE=TEXT NAME=LNAME>
    <BR><BR>
    <A HREF="javascript:CreateMsg();">Create Message</A>
    <BR><BR>
    <SPAN ID="MSG">&nbsp;</SPAN>
    </FORM>
    </BODY>
    </HTML>

  6. #6
    hazhood's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2010
    Posts
    1

    Form as part of a hyperlink

    This is very helpful. I have a slightly different task I'm trying to accomplish. How do I get the results of a form to be part of a hyperlink.

    enter username: "sample" (user enters sample into form)

    then press (enter,input,go to, etc)

    sends them to http://www.howto.com/sample

    where "sample" is the result of the form



Tags for this Thread