aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Prepopulate a form field with data entered on a previous page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Prepopulate a form field with data entered on a previous page" Watch "Prepopulate a form field with data entered on a previous page" New topic
Author

Prepopulate a form field with data entered on a previous page

Angela Greig
Greenhorn

Joined: Aug 03, 2011
Posts: 1
Help. I am totally lost. I'm trying to put together a website for a friend, and the last programming class I took was Fortran, so forgive me if I don't know proper terminology.

In the footer of my index page, http://www.greig.org/mc/Morgan%20Consultants/MC/index.html, I have a box where a person can input an email address to sign up to receive a company e-newsletter. When you hit "GO" it takes you to the Newsletter Signup page.

<form action="newslettersignup.html" method="post">
<fieldset>
<legend>News Letter</legend>
<input type="text" name="email" value="Enter Email Here…" onfocus="this.value=(this.value=='Enter Email Here…')? '' : this.value ;" />
<input type="submit" name="news_go" id="news_go" value="GO" />
</fieldset>
</form>

When you get to the Newsletter Signup page, http://www.greig.org/mc/Morgan%20Consultants/MC/newslettersignup.html, I want the form to pre-populate the Your Email field with the email that the user previously entered in the footer of the index page. Here's the code for my form:

<form method="post" action="sendmail.php">
<fieldset id="formplusreply">
<legend>Newsletter Signup</legend>
<label for="email">Your Email:
<input id="email" name="email" type="text" size="50">
</label>
<label for="firstname">First Name:
<input id="firstname" name="firstname" type="text" size="50">
</label>
<label for="lastname">Last Name:
<input id="lastname" name="lastname" type="text" size="50">
</label>
<label for="company">Company:
<input id="company" name="company" type="text" size="50">
</label>
<label for="position">Position/Title:
<input id="position" name="position" type="text" size="50">
</label>
<label class="submit" for="submit">
<input id="submit" type="submit" value="Submit">
</label>
</fieldset>
</form>


I know I need to pass some variable, but I have no idea how to modify the code to do so, and I can't find explicit help on the web. Thanks for any help you can provide.

Angela
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Prepopulate a form field with data entered on a previous page