Two ways to do this... client-side and server-side. Server-side would be the more "correct" way to do it:
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 M6
·
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.
You appear to be missing the critical element: the
This will cause the information contained in any valid form elements between 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.
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.
You need to use some scripting languages like asp or php
and to put your html in a Form tag
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 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. :)