Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Pre populate a form field with value submitted on another page

Posted on 2007-04-06
8
Medium Priority
?
1,585 Views
Last Modified: 2012-08-13
I have a form where the input from user are sent by mail to a specific address.
My client wants an additional feature with the form. They want a text box on all the pages to enter zio code When the user enter their zip code in the text box, and click submit,  they should be directed to the form with the zip code value which the user has submitted, already filled in the form.
The processing of the form is done in asp.
Please help how to do it.
Thank you in advance
0
Comment
Question by:soniya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 18868931
if you want to pass the form's values into another new form (page), you may try use:

1. cookie, or
2. via server side scripting.

for me, i would prefer to use server side scripting since you mentioned to use asp here.
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 200 total points
ID: 18868933
so in your second page, to auto-fill the value user had submitted, you may try like this:


<input name="zipcode" type="text" id="zipcode" value="<%=request("zipcode")%>">


where you got an element called "zipcode" in your 1st form (page) to be filled in by user.

let us know if you need futher assistance here, hope this helps
0
 
LVL 3

Author Comment

by:soniya
ID: 18869022
Please help me with the code for sending the zipcode to the quote.asp.

This is the form for Zip code input:

<form id="quoteform" method="get" action="quote.asp" ><p>
              <input type="text" name="zip" />
              <br />Enter Zip Code<br>
              <input type="submit" name="Submit" value="Enter" />
</form>

and
The form on quote.asp contains

<input name="zip" type="text" id="zip" value="<%=request("zip")%>">

Thank you
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 53

Expert Comment

by:Ryan Chong
ID: 18869131
seems your pages are working here, any problem?
0
 
LVL 3

Author Comment

by:soniya
ID: 18869188
It was not working when I posted the reply, But it is working now, thank you.
0
 

Expert Comment

by:huzefaq
ID: 22461924
zxcxzv
0
 

Expert Comment

by:doncalarco
ID: 26434408
I tried Soniya's code and nothing happened.  can the receiving page be .php?
0
 
LVL 3

Author Comment

by:soniya
ID: 26439956
You can test and see the code working at http://hues.in/zip1.asp.
These are asp files and same thing can be done in php. You will just have to replace asp code with php code.

Here is the code of my files.

#! zip.asp

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Description" content="" />
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
<meta name="author" content="Soniya Mathur" />
</head>
<body>
<div id="wrap">
  <form id="quoteform" method="get" action="zip1.asp" >
    <p>
      <input type="text" name="zip" />
      <br />
      Enter Zip Code <br />
      <br />
      <input type="submit" name="Submit" value="Enter" />
  </form>
 
</div>
</body>
</html>
++++++++++++++++++++++++++++++++++++++++++++++++++++
And
#2 zip1.asp

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Description" content="" />
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
<meta name="author" content="Soniya Mathur" />
</head>
<body>
<div id="wrap">

  <form  name="quote1" id="form2" method="post" action="zip2.asp" onload="readText(this.form)" >
    <table width="100%" border="0" cellspacing="1" cellpadding="0">
      <tr>
        <td>Name<span class="red">*</span></td>
        <td><input name="name" type="text" /></td>
      </tr>
      <tr>
        <td>Email Address<span class="red"> * </span></td>
        <td><input name="email" type="text" /></td>
      </tr>
      <tr>
        <td>Phone #1<span class="red"> *</span></td>
        <td><input name="phone1" type="text" />
          <select name="ph">
            <option selected="selected" value="Home">Home</option>
            <option value="Work">Work</option>
            <option value="Cell">Cell</option>
          </select></td>
      </tr>
      <tr>
        <td>Phone #2</td>
        <td><input name="phone2" type="text" />
          <select name="ph2">
            <option selected="selected" value="Home">Home</option>
            <option value="Work">Work</option>
            <option value="Cell">Cell</option>
            <option value="Fax">Fax</option>
            <option value="Other">Other</option>
          </select>
        </td>
      </tr>
      <tr>
        <td>Address <span class="red">*</span></td>
        <td><textarea name="address"></textarea></td>
      </tr>
      <tr>
        <td>City <span class="red">*</span></td>
        <td><input name="city" type="text" />
        </td>
      </tr>
      <tr>
        <td>State <span class="red">*</span></td>
        <td><select name="state" >
            <option value="Alabama">Alabama</option>
            <option value="Alaska">Alaska</option>
            <option value="Arizona">Arizona</option>
            <option value="Arkansas">Arkansas</option>
            <option value="California">California</option>
            <option value="Colorado">Colorado</option>
            <option value="Connecticut">Connecticut</option>
            <option value="Delaware">Delaware</option>
            <option value="Disrict of Columbia">Disrict of Columbia</option>
            <option value="Florida">Florida</option>
            <option value="Georgia">Georgia</option>
            <option value="Hawaii">Hawaii</option>
            <option value="Illinois">Illinois</option>
            <option value="Indiana">Indiana</option>
            <option value="Iowa">Iowa</option>
            <option value="Kansas">Kansas</option>
            <option value="Kentucky">Kentucky</option>
            <option value="Louisiana">Louisiana</option>
            <option value="Maine">Maine</option>
            <option value="Maryland">Maryland</option>
            <option value="Massachuesetts">Massachuesetts</option>
            <option value="Michigan">Michigan</option>
            <option value="Minnesota">Minnesota</option>
            <option value="Mississippi">Mississippi</option>
            <option value="Missouri">Missouri</option>
            <option value="Montana">Montana</option>
            <option value="Nebraska">Nebraska</option>
            <option value="Nevada">Nevada</option>
            <option value="New Hampshire">New Hampshire</option>
            <option value="New Jersey">New Jersey</option>
            <option value="New Mexico">New Mexico</option>
            <option value="New York">New York</option>
            <option value="North Carolina">North Carolina</option>
            <option value="North Dakota">North Dakota</option>
            <option value="Ohio">Ohio</option>
            <option value="Oklahoma">Oklahoma</option>
            <option value="Oregon">Oregon</option>
            <option value="Pennsylvania">Pennsylvania</option>
            <option value="Rhode Island">Rhode Island</option>
            <option value="South Carolina">South Carolina</option>
            <option value="South Dakota">South Dakota</option>
            <option value="Tennessee">Tennessee</option>
            <option value="Texas">Texas</option>
            <option value="Utah">Utah</option>
            <option value="Vermont">Vermont</option>
            <option value="Virginia">Virginia</option>
            <option value="Washington">Washington</option>
            <option value="West Virginia">West Virginia</option>
            <option value="Wisconsin">Wisconsin</option>
            <option value="Wyoming">Wyoming</option>
          </select></td>
      </tr>
      <tr>
        <td>Zip<span class="red"> *</span></td>
        <td><input name="zip" type="text" id="zip" value="<%=request("zip")%>"></td>
      </tr>
      <tr>
        <td>County <span class="red">* </span></td>
        <td><input name="county" type="text" /></td>
      </tr>
      <tr>
        <td>Reason for Request? <span class="red">*</span> </td>
        <td><select name="request1">
            <option selected="selected" value="New Purchase">New Purchase</option>
            <option value="Moving to Florida">Moving to Florida</option>
            <option value="Upset with claims">Upset with claims</option>
            <option value="Upset with service">Upset with service</option>
            <option value="Paying too much">Paying too much</option>
            <option value="Getting cancelled">Getting cancelled</option>
            <option value="Terminated due to non-payment">Terminated due to non-payment</option>
            <option value="Insuring my current home for the first time">Insuring my current home for the first time</option>
          </select>
        </td>
      </tr>
      <tr>
        <td>This home is:<span class="red"> *</span></td>
        <td><input type="text" name="thishome" /></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><input type="submit" name="Submit2" value="Continue" /></td>
      </tr>
    </table>
  </form>
</div>
</body>
</html>


0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question