iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-17-2005, 01:05 PM
WebProWorld Member
 
Join Date: Sep 2003
Posts: 79
ambassador RepRank 0
Default Pre-populating an HTML Form with Data from Another HTML Form

-------
May 17, 2005

Here is the scenario.

A simple HTML form exists on web page 1 (a static HTML page).
Another HTML form exists on web page 2 (a static HTML page).
The form on page 2 has several fields also found on the page 1 form.
Both forms have a simple HTML submit button.


The question.

If both forms have input fields for 'name' and 'address' and the website viewer enters their name and address on the page 1 form first, how do you pre-populate the page 2 form with the viewers name and address so they do not have to re-enter the same information?


Ambassador
-------
Reply With Quote
  #2 (permalink)  
Old 05-17-2005, 02:05 PM
ADAM Web Design's Avatar
WebProWorld 1,000+ Club
 
Join Date: Dec 2003
Location: Toronto, Ontario, Canada
Posts: 2,181
ADAM Web Design RepRank 1
Default

I can't think of a good way to retrieve the information for the second form bia any means other than to use server-side programming.

Here's a quick and not-optimized ASP sample for the second form:
Code:
<%
Dim Customer_Name
Customer_Name = trim (Request.Form ("Customer_Name")
%>
<input type="hidden" name="Customer_Name" value="<% = Customer_Name %>" />
This would vary depending on which server-side programming language you used.

There would be a way to do this using Javascript, but then you'd have to rely on people enabling it.
Reply With Quote
  #3 (permalink)  
Old 05-17-2005, 04:29 PM
WebProWorld Pro
 
Join Date: Aug 2004
Location: Maryland
Posts: 219
webmasterjunkie RepRank 0
Default This Should Do It

If a relative URL is used in:
<form method="POST" action="">
Instead of:
<form method="POST" action="http://ww8.website.com">:
Then $variable replacements may be used on the next page to fill in what your visitor typed on the previous page.

Form1
<input type="text" name="first">

Form2
<input type="text" name="first" value="$first">

That should take care of the issue, of course you should validate the fields to ensure that they are filled out.
Reply With Quote
  #4 (permalink)  
Old 06-19-2005, 10:12 PM
WebProWorld Member
 
Join Date: Sep 2003
Posts: 79
ambassador RepRank 0
Default

-------
Jun 19, 2005

Thank you webmasterjunkie.

Ambassador
-------
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:43 AM.



Search Engine Optimization by vBSEO 3.3.0