English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am trying to send the results of a html form onto another local webpage, any help with how to do this

Example, I have the following code:



First Name:

Last Name:






Now by clicking the "Submit" Button, I want the information on say
http://url1.com to go to http://url2.com

where it appears like Your name is XXXXX YYYYYY

Any help on this would be appreciated ... Thanks

2007-02-23 07:47:46 · 6 answers · asked by Yahya d 3 in Computers & Internet Programming & Design

6 answers

Two ways to do this... client-side and server-side. Server-side would be the more "correct" way to do it:


your form stuff here


The receiveform.aspx script on the destination server will receive the user's input into the form in the POST header of the web request. It would read something like Request.Form["form-element-name"], which you could then output to the page. PHP, CFM, JSP, CGI all also have similar methods of doing this; just the syntax is a little different.

For client-side, you could change the method parameter of the form tag from POST to GET, and on the page of url2.com, you could retrieve the form data with JavaScript:





Edit: also, if you do use the server-side method (recommended), don't use the below advice to replace the submit button with JavaScript. That's pointless because submit works just fine, and if your visitors have JavaScript disabled (many do), your form won't work at all.

2007-02-23 07:55:11 · answer #1 · answered by Rex M 6 · 0 0

Don't use submit. Instead use a button that activates a javascript function. Check the web for a function that will read and write cookies. Store the name in a cookie on the first page and retrieve it on the second page. That is the easiest way to pass parameters between pages. Another is to add it to the end of a URL following a question mark and retrieve it in the called page. The cookie is neater.

2007-02-23 07:55:43 · answer #2 · answered by Barkley Hound 7 · 0 1

You appear to be missing the critical element: the

tag.

Also, you're missing proper closing tags within your table for the cells and rows.

Revise your code to something like this:











First Name:
Last Name:






This will cause the information contained in any valid form elements between
and
to be posted to whatever URL is defined in the ACTION parameter of your FORM tag.

You will need to use some kind of server-side scripting to process the result at url2.com.

In PHP, this would look something like:


echo "Your name is " . $_POST['First Name'] . " " . $_POST['Last Name'];

?>

echo causes whatever comes after that (up to the semi-colon) to be displayed to the viewer. $_POST is a global variable in PHP that contains all the elements that were posted to that page from the previous page. You should notice that $_POST matches the METHOD parameter in the FORM tag of "post". You will also notice that the key reference inside the $_POST variables ("First Name" and "Last Name") exactly match the values in the NAME parameter for your INPUT fields.

The period (.) is a way of concatenating the string values within the echo statement.

Syntax will vary depending on what language you use to process your form. What I showed was PHP, but you could use ASP, Perl, or others.

Good luck.

2007-02-23 08:05:59 · answer #3 · answered by wa-webguy 3 · 0 1

You need to do some server-side processing to display the information. PHP is a simple and popular way to do this. Here's a tutorial:
http://us2.php.net/tut.php

It's simple to make the content appear in the window from which it was called. It's also fairly simple to update another web page so that the next time it is accessed it has the new information. However, if you want the information displayed in url2.htm to automatically update based on what someone does in url1.htm, you'll have to do server pushes or something similar. Google for more info. If they are indeed separate domains, there's probably a way but I don't know what it is.

2007-02-23 08:06:35 · answer #4 · answered by injanier 7 · 0 1

You need to use some scripting languages like asp or php
and to put your html in a Form tag




First Name:

Last Name:





then in the otehr script code
if it is asp it wolud look like this
<%
Dim FirstName,SecondName
FirstName = Request.Form("FirstName")
SecondName = = Request.Form("LastName")
%>
Or you can just forget all what i am saying and see for your self
http://www.w3schools.com

it is great for beginner........

2007-02-23 07:59:15 · answer #5 · answered by medoelprinse 1 · 0 1

it would look some thing like this: "index.own residing house web page" html body field a million: field 2: body html upon getting this kind created... open up the web page that the type is meant to direct to. type proper the following: "nameofdocument.own residing house web page" html body br br body html Now regardless of you submitted into field a million will take position on the web page once you take advantage of the code: echo $_POST [ ' text1' ] ; and regardless of you submitted into field 2 interior the type will take position on the web page at the same time as utilizing the code: echo $_POST [ ' text2' }; optimistically this helps you. :)

2016-12-04 20:44:54 · answer #6 · answered by sobczak 4 · 0 0

fedest.com, questions and answers