Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing/Retrieving input fields from 1 webpage to another

Status
Not open for further replies.

victory92

Programmer
Sep 18, 2002
35
US
I am trying to pass input fields from one page to another. Here is an example that I am getting "name" in the t1.htm page - and trying to pass to t2.htm page.

T1.htm is

<body>

<form method="POST" action="t2.htm">
<p><input type="text" name="name" size="20"></p>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>


What is the code in t2.htm to retrieve the "name" input text? FYI - I am using Front Page if that makes a difference.

Thanks for any help!! Bear in mind that I am new at this!!

I've tried using GET for the action in t2.htm with no success.

 

Name is a reserved word, and should not be used for element names.

After all, when you refer to "form.name", should it refer to the name of the form, or the element within the form called "name"?

Onto your question, because you are using the "post" method, you will not be able to retrieve the value using just JS on page 2. If you use the "get" method, you will be able to, as the values will be passed in the URL, and you can simply skim them off. Using "post", you would have to use server-side coding.

Hope this helps,
Dan
 
yup,
refer to the location.search function...

Known is handfull, Unknown is worldfull
 
Could I have a form within a form -- one doing a POST and the other doing a GET? I need to update a DataBase - so I need the Post -- but also need to pass a input field.

Do you have an example in which to skim off data in the URL?

Thanks!!
 

I'll make an assumption here that you're using a server-side language (how else would be harvesting the form info into a database?).

That being the case, why do you not pass the info back to the next page from the server, prepopulating the fields as they are rendered?

Dan
 
I am using PHP to update the database. My Front Page HTML code sends a redirect URL. I would like to send the needed fields via PHP but have been unable to do so.

Are you suggestion that I add the fields to the redirect statements using the Question Mark (?) to delimit the URL and Ampersands (&) to delimit fields. Will this work??

I don't know how to repopulate the fields on the screen.

Please realize I am very new at this...

Thanks!
 

I'd suggest asking in the PHP forum on how to output dynamic content to a page (something that any PHP coder should be able to help you with).

Hope this helps,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top