Pre populate a form field with value submitted on another page

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
LVL 3
soniyaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
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
Ryan ChongCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
soniyaAuthor Commented:
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Ryan ChongCommented:
seems your pages are working here, any problem?
0
soniyaAuthor Commented:
It was not working when I posted the reply, But it is working now, thank you.
0
huzefaqCommented:
zxcxzv
0
doncalarcoCommented:
I tried Soniya's code and nothing happened.  can the receiving page be .php?
0
soniyaAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.